我的CPT是使用插件创建的,因此我不能编辑support参数来添加对自定义字段的支持。
我试过使用这段代码,但是它也不起作用
add_action('init', 'custom_child_init');
function custom_child_init() {
add_theme_support( 'custom-fields' );
}如何为单个自定义post类型启用编辑页屏幕上的自定义字段元框?
发布于 2019-09-26 13:15:48
试试这个。只需用post类型更改CPT即可。
function wpcodex_add_excerpt_support_for_cpt() {
add_post_type_support( 'CPT', 'custom-fields' );
}
add_action( 'init', 'wpcodex_add_excerpt_support_for_cpt' );https://wordpress.stackexchange.com/questions/349162
复制相似问题