CPT > When checking "Supports > Editor" custom fields disappear

Support MB Custom Post Type CPT > When checking "Supports > Editor" custom fields disappear

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #44903
    KaraKara
    Participant

    I'm using Meta Box AIO to create a CPT: "Member Contents"

    Initially, I didn't need this post to support the "Editor" field, but now I do need it.

    When I check the box to add it though, the other custom fields don't show up in the back end.
    (The data is still there as it displays correctly on the front end).

    For example, is this without supports: Editor being checked:
    https://tinyurl.com/2yqcad28

    And the same post with "Editor" being checked:
    https://tinyurl.com/2ddk9cv6

    On the Preferences > Panels, none of the custom field groups (for this post: "Member Contents Wizard" and "Roadmaps") are not listed as an option:
    https://tinyurl.com/23l8kq6k

    But, the they are saved as generic Custom Fields (which do not populate on the front end):

    I've tried deactivating all plugins except Meta Box AIO and Meta Box but no luck.

    Here's the PHP code from the CPT:

    <div>
    <?php
    add_action( 'init', 'your_prefix_register_post_type' );
    function your_prefix_register_post_type() {
    	$labels = [
    		'name'                     => esc_html__( 'Member Contents', 'your-textdomain' ),
    		'singular_name'            => esc_html__( 'Member Content', 'your-textdomain' ),
    		'add_new'                  => esc_html__( 'Add New', 'your-textdomain' ),
    		'add_new_item'             => esc_html__( 'Add New Member Content', 'your-textdomain' ),
    		'edit_item'                => esc_html__( 'Edit Member Content', 'your-textdomain' ),
    		'new_item'                 => esc_html__( 'New Member Content', 'your-textdomain' ),
    		'view_item'                => esc_html__( 'View Member Content', 'your-textdomain' ),
    		'view_items'               => esc_html__( 'View Member Contents', 'your-textdomain' ),
    		'search_items'             => esc_html__( 'Search Member Contents', 'your-textdomain' ),
    		'not_found'                => esc_html__( 'No member contents found.', 'your-textdomain' ),
    		'not_found_in_trash'       => esc_html__( 'No member contents found in Trash.', 'your-textdomain' ),
    		'parent_item_colon'        => esc_html__( 'Parent Member Content:', 'your-textdomain' ),
    		'all_items'                => esc_html__( 'All Member Contents', 'your-textdomain' ),
    		'archives'                 => esc_html__( 'Member Content Archives', 'your-textdomain' ),
    		'attributes'               => esc_html__( 'Member Content Attributes', 'your-textdomain' ),
    		'insert_into_item'         => esc_html__( 'Insert into member content', 'your-textdomain' ),
    		'uploaded_to_this_item'    => esc_html__( 'Uploaded to this member content', 'your-textdomain' ),
    		'featured_image'           => esc_html__( 'Featured image', 'your-textdomain' ),
    		'set_featured_image'       => esc_html__( 'Set featured image', 'your-textdomain' ),
    		'remove_featured_image'    => esc_html__( 'Remove featured image', 'your-textdomain' ),
    		'use_featured_image'       => esc_html__( 'Use as featured image', 'your-textdomain' ),
    		'menu_name'                => esc_html__( 'Member Contents', 'your-textdomain' ),
    		'filter_items_list'        => esc_html__( 'Filter member contents list', 'your-textdomain' ),
    		'filter_by_date'           => esc_html__( '', 'your-textdomain' ),
    		'items_list_navigation'    => esc_html__( 'Member Contents list navigation', 'your-textdomain' ),
    		'items_list'               => esc_html__( 'Member Contents list', 'your-textdomain' ),
    		'item_published'           => esc_html__( 'Member Content published.', 'your-textdomain' ),
    		'item_published_privately' => esc_html__( 'Member Content published privately.', 'your-textdomain' ),
    		'item_reverted_to_draft'   => esc_html__( 'Member Content reverted to draft.', 'your-textdomain' ),
    		'item_scheduled'           => esc_html__( 'Member Content scheduled.', 'your-textdomain' ),
    		'item_updated'             => esc_html__( 'Member Content updated.', 'your-textdomain' ),
    		'text_domain'              => esc_html__( 'your-textdomain', 'your-textdomain' ),
    	];
    	$args = [
    		'label'               => esc_html__( 'Member Contents', 'your-textdomain' ),
    		'labels'              => $labels,
    		'description'         => '',
    		'public'              => true,
    		'hierarchical'        => false,
    		'exclude_from_search' => false,
    		'publicly_queryable'  => true,
    		'show_ui'             => true,
    		'show_in_nav_menus'   => true,
    		'show_in_admin_bar'   => true,
    		'show_in_rest'        => true,
    		'query_var'           => true,
    		'can_export'          => true,
    		'delete_with_user'    => false,
    		'has_archive'         => true,
    		'rest_base'           => '',
    		'show_in_menu'        => true,
    		'menu_position'       => '',
    		'menu_icon'           => 'dashicons-lock',
    		'capability_type'     => 'post',
    		'supports'            => ['title', 'thumbnail', 'excerpt', 'page-attributes', 'custom-fields', 'revisions', 'editor'],
    		'taxonomies'          => ['content-type', 'format', 'department', 'resource', 'community', 'training', 'content-types', 'topic'],
    		'rewrite'             => [
    			'with_front' => false,
    		],
    	];
    
    	register_post_type( 'member-content', $args );
    }
    </div>
    #44917
    PeterPeter
    Moderator

    Hello,

    Please edit the field group > Settings tab > Position: select After content > Save. If you use the code to register the meta box, please set context to normal.
    Following the documentation https://docs.metabox.io/creating-fields-with-code/
    and screenshot https://imgur.com/1W4vKgV

    Let me know how it goes.

    #44918
    KaraKara
    Participant

    Hi Peter -

    I've done exactly that and no luck.
    Screen recording: https://www.awesomescreenshot.com/video/25955993?key=bbc80aec7bf5e7227d1083c175865feb

    But, if I add the same custom fields to another post, they show up as expected.
    Screen recording: https://www.awesomescreenshot.com/video/25956296?key=75a46229b4b367951525b4c170d6f44c

    Conversely, if I create new custom fields to show up on the original CPT, that works fine, too.
    Screen recording: https://www.awesomescreenshot.com/video/25955993?key=bbc80aec7bf5e7227d1083c175865feb

    I have hundreds of posts created using the custom field group, connected to dynamic templates on the front-end, and so don't want to re-create these if possible.

    #44920
    KaraKara
    Participant

    Hi Peter -

    This might help.

    This is what the console shows on the CPT = Member Contents, with "editor" supported.
    We can see the test field group showing up properly:
    https://tinyurl.com/2d3kzfgj

    And the "Member Contents Wizard" section with class="hidden"
    https://tinyurl.com/28pbn4bm

    #44932
    PeterPeter
    Moderator

    Hello,

    Please share your site credentials via this contact form https://metabox.io/contact/
    I will take a look.

    #44936
    KaraKara
    Participant

    Sent, and thank you!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.