我写了一些php代码为我的网站添加自定义字段到标题,但当我添加它时,我得到语法错误,它破坏了我的网站。
add_filter( 'pt_cv_fields_html', 'cvp_theme_other_fields_in_title', 100, 2 );
function cvp_theme_other_fields_in_title( $args, $post ) {
global $pt_cv_id;
if ( in_array( $pt_cv_id, array( 'e3cd1844un', '60d308bw40' ) ) ) {
if ( isset( $args[ 'custom-fields' ] ) ) {
$args[ 'title' ] .= " " . strip_tags( $args[ 'custom-fields' ] );
unset( $args[ 'custom-fields' ] );
}
}
return $args;
}因为我是php的新手,所以在这里抓不住我的头。看不出我做错了什么。
发布于 2020-10-29 02:05:23
实际上,实际代码中没有错误,但我忘了在注释字段中添加结尾//。
https://stackoverflow.com/questions/64577781
复制相似问题