最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Enable Custom Fields For Custom Post Type When CPT Created Using Plugin

programmeradmin0浏览0评论

My CPT is created using a plugin so i cannot edit the supports parameter to add support for custom fields.

I tried using this code however it doesn't work either

add_action('init', 'custom_child_init');
function custom_child_init() {
    add_theme_support( 'custom-fields' );
}

How do i enable the custom field meta box on the Edit Page screen for single custom post types?

My CPT is created using a plugin so i cannot edit the supports parameter to add support for custom fields.

I tried using this code however it doesn't work either

add_action('init', 'custom_child_init');
function custom_child_init() {
    add_theme_support( 'custom-fields' );
}

How do i enable the custom field meta box on the Edit Page screen for single custom post types?

Share Improve this question asked Sep 26, 2019 at 12:51 Brad DaltonBrad Dalton 6,9852 gold badges36 silver badges47 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Try with this. just change CPT with your post type.

function wpcodex_add_excerpt_support_for_cpt() {
    add_post_type_support( 'CPT', 'custom-fields' );
}
add_action( 'init', 'wpcodex_add_excerpt_support_for_cpt' );
发布评论

评论列表(0)

  1. 暂无评论