Custom Fields
Re-Envisioned
Support MB Custom Post Type Newly created custom post type name is not showing up in wordpress dashboard - l

  • Creator
    Topic
  • #32967
    Resolved sharebiology@gmail.com
    Participant

    Hello,

    The newly created custom post type name is not showing up in the WordPress dashboard - left sidebar. I have deactivated all plugins (except metabox and metabox AIO). still no luck. I am attaching a screenshot for reference.

    I have assigned the menu position after "fluorescent proteins". Fluorescent proteins is another CPT created a couple of years ago.

    one possible reason is I might have created CPT with this name years ago. Other than that I can not figure out what went wrong.

    https://sharebiology-gmail-com.nimbusweb.me/s/share/6459073/hp9vctddlltm3niwvm33

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #32971
    Long Nguyen
    Moderator

    Hi,

    Please try to re-save the permalink settings (Post name) to flush the cache and re-check the CPT.

    #32972

    Hi,

    I did and it is not working
    any other solution?

    #32978
    Long Nguyen
    Moderator

    Hi,

    Can you please share the code that creates the CPT? Refer to this documentation to get PHP code https://docs.metabox.io/extensions/meta-box-builder/#getting-php-code

    #32998

    Hello,

    Here is the code

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

    Hi,

    The post type slug must not exceed 20 characters and may only contain lowercase alphanumeric characters, dashes, and underscores. Refer to this documentation https://developer.wordpress.org/reference/functions/register_post_type/

    The slug tissue-clearing-method has more than 20 characters. You can change it to something like tissue-clearing.

    #33013

    Working now.

    Thanks 🙂

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