Add New post to existing CPT > White Screen

Support MB Custom Post Type Add New post to existing CPT > White ScreenResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #27391
    KaraKara
    Participant

    Hi there -

    I created a CPT and added it to my theme functions file. It was working well but the CPT would not show on the front end. I took a tip from another forum post to change permalinks to plain and that fixed it.
    I switched the permalinks back to Post Name and it still works on the front end, but now I can't edit or create new posts for the CPT on the back end. Editing existing posts or trying to add new results in completely white screen.

    I can create a new CPT and it works fine.

    Here's my code:

    <?php
    add_action( 'init', 'your_prefix_register_post_type' );
    function your_prefix_register_post_type() {
        $labels = [
            'name'                     => esc_html__( 'Coaching', 'your-textdomain' ),
            'singular_name'            => esc_html__( 'Coaching', 'your-textdomain' ),
            'add_new'                  => esc_html__( 'Add New', 'your-textdomain' ),
            'add_new_item'             => esc_html__( 'Add new coaching', 'your-textdomain' ),
            'edit_item'                => esc_html__( 'Edit Coaching', 'your-textdomain' ),
            'new_item'                 => esc_html__( 'New Coaching', 'your-textdomain' ),
            'view_item'                => esc_html__( 'View Coaching', 'your-textdomain' ),
            'view_items'               => esc_html__( 'View Coaching', 'your-textdomain' ),
            'search_items'             => esc_html__( 'Search Coaching', 'your-textdomain' ),
            'not_found'                => esc_html__( 'No coaching found', 'your-textdomain' ),
            'not_found_in_trash'       => esc_html__( 'No coaching found in Trash', 'your-textdomain' ),
            'parent_item_colon'        => esc_html__( 'Parent Coaching:', 'your-textdomain' ),
            'all_items'                => esc_html__( 'All Coaching', 'your-textdomain' ),
            'archives'                 => esc_html__( 'Coaching Archives', 'your-textdomain' ),
            'attributes'               => esc_html__( 'Coaching Attributes', 'your-textdomain' ),
            'insert_into_item'         => esc_html__( 'Insert into coaching', 'your-textdomain' ),
            'uploaded_to_this_item'    => esc_html__( 'Uploaded to this coaching', '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__( 'Coaching', 'your-textdomain' ),
            'filter_items_list'        => esc_html__( 'Filter coaching list', 'your-textdomain' ),
            'items_list_navigation'    => esc_html__( 'Coaching list navigation', 'your-textdomain' ),
            'items_list'               => esc_html__( 'Coaching list', 'your-textdomain' ),
            'item_published'           => esc_html__( 'Coaching published', 'your-textdomain' ),
            'item_published_privately' => esc_html__( 'Coaching published privately', 'your-textdomain' ),
            'item_reverted_to_draft'   => esc_html__( 'Coaching reverted to draft', 'your-textdomain' ),
            'item_scheduled'           => esc_html__( 'Coaching scheduled', 'your-textdomain' ),
            'item_updated'             => esc_html__( 'Coaching updated', 'your-textdomain' ),
            'text_domain'              => esc_html__( 'your-textdomain', 'your-textdomain' ),
        ];
        $args = [
            'label'               => esc_html__( 'Coaching', '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'    => true,
            'has_archive'         => false,
            'rest_base'           => '',
            'show_in_menu'        => true,
            'menu_icon'           => 'dashicons-star-empty',
            'menu_position'       => 28,
            'capability_type'     => 'post',
            'supports'            => ['title', 'editor', 'thumbnail'],
            'taxonomies'          => [],
            'rewrite'             => [
                'with_front' => false,
            ],
        ];
    
        register_post_type( 'coaching', $args );
    }

    From the error console when I try to add new:

    Uncaught (in promise) Error: The entity being edited (postType, undefined) does not have a loaded config.
        at core-data.min.js?ver=cae70cc4927f8b371fa13262d47b23e0:2
        at tryCatch (wp-polyfill.min.js?ver=7.4.4:1)
        at Generator.invoke [as _invoke] (wp-polyfill.min.js?ver=7.4.4:1)
        at Generator.t.<computed> [as next] (wp-polyfill.min.js?ver=7.4.4:1)
        at redux-routine.min.js?ver=284288e957394d2097c6fbe95625e2fb:2
        at redux-routine.min.js?ver=284288e957394d2097c6fbe95625e2fb:2
        at redux-routine.min.js?ver=284288e957394d2097c6fbe95625e2fb:2
        at Array.some (<anonymous>)
        at e (redux-routine.min.js?ver=284288e957394d2097c6fbe95625e2fb:2)
        at redux-routine.min.js?ver=284288e957394d2097c6fbe95625e2fb:2
    post-new.php?post_type=coaching:1 Unchecked runtime.lastError: The message port closed before a response was received.
    #27407
    Long NguyenLong Nguyen
    Moderator

    Hi,

    To troubleshoot this issue, please follow the step Debugging Information and let me know how it goes.
    https://support.metabox.io/topic/how-to-create-a-new-topic/

    #27429
    KaraKara
    Participant

    Debug:
    Deactivating all but Meta box/Meta Box AIO --> same results as above

    WP Debug gives the following:

    Notice: register_taxonomy was called incorrectly. The "type" taxonomy "name" property (type) conflicts with an existing property on the REST API Posts Controller. Specify a custom "rest_base" when registering the taxonomy to avoid this error. Please see Debugging in WordPress for more information. (This message was added in version 5.4.0.) in /wordpress/wp-includes/functions.php on line 5313 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132 Warning: Illegal offset type in /wordpress/wp-includes/post.php on line 1953 Warning: Illegal offset type in /wordpress/wp-includes/post.php on line 1953 Warning: Illegal offset type in /wordpress/wp-includes/post.php on line 1953 Warning: Illegal offset type in /wordpress/wp-includes/post.php on line 1953 Notice: Undefined index: id in /www/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-rest-api/class-mb-rest-api.php on line 132

    There shouldn't be anything else (besides this CPT) using "coaching" as it's taxonomy.

    #27434
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Thank you for your additional information.

    Does the taxonomy of the CPT coaching have the slug type? It might conflict with the Reserved Terms of WordPress https://codex.wordpress.org/Reserved_Terms

    Please change the slug of the taxonomy Type to another and re-save the permalink.

    Let me know if it helped.

    #27436
    KaraKara
    Participant

    Hi Long -

    Yes, that was it. I had forgotten I had added a custom taxonomy with the slug: type last week. I recall seeing in the changelog that the plugin will now error when trying to use a reserved slug and sure enough, when I just checked on this, I see the error message.

    I've deleted the taxonomy and the problem is fixed.

    Thanks for your help!

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