Newly created custom post type name is not showing up in wordpress dashboard - l
Support › MB Custom Post Type › Newly created custom post type name is not showing up in wordpress dashboard - lResolved
- This topic has 9 replies, 5 voices, and was last updated 2 years, 1 month ago by
Vipinn.
-
AuthorPosts
-
January 3, 2022 at 5:01 PM #32967
[email protected]
ParticipantHello,
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
January 3, 2022 at 9:22 PM #32971Long Nguyen
ModeratorHi,
Please try to re-save the permalink settings (Post name) to flush the cache and re-check the CPT.
January 3, 2022 at 10:39 PM #32972[email protected]
ParticipantHi,
I did and it is not working
any other solution?January 4, 2022 at 9:56 AM #32978Long Nguyen
ModeratorHi,
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
January 5, 2022 at 1:51 AM #32998[email protected]
ParticipantHello,
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 ); }
January 5, 2022 at 12:45 PM #33006Long Nguyen
ModeratorHi,
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 liketissue-clearing
.January 5, 2022 at 6:12 PM #33013[email protected]
ParticipantWorking now.
Thanks 🙂
April 5, 2023 at 1:34 AM #41348Jordan
ParticipantIs there a way to increase the character limit in the URL? This is not good for our SEO, to choose less than 20 characters.
April 5, 2023 at 7:16 PM #41358Peter
ModeratorHello Jordan,
You can try to use the
rewrite
option to set the unlimited characters for CPT slug. It is not restricted by WordPress. Refer to the documentation https://developer.wordpress.org/reference/functions/register_post_type/#rewriteApril 7, 2023 at 8:16 PM #41385Vipinn
ParticipantSame issue, newly created post type is not visible in the Dashboard menu. Here's the code:
add_action( 'init', 'e78_register_post_type_cs' ); function e78_register_post_type_cs() { $labels = [ 'name' => esc_html__( 'Case Studies', 'e78' ), 'singular_name' => esc_html__( 'Case Study', 'e78' ), 'add_new' => esc_html__( 'Add New', 'e78' ), 'add_new_item' => esc_html__( 'Add New Case Study', 'e78' ), 'edit_item' => esc_html__( 'Edit Case Study', 'e78' ), 'new_item' => esc_html__( 'New Case Study', 'e78' ), 'view_item' => esc_html__( 'View Case Study', 'e78' ), 'view_items' => esc_html__( 'View Case Studies', 'e78' ), 'search_items' => esc_html__( 'Search Case Studies', 'e78' ), 'not_found' => esc_html__( 'No case studies found.', 'e78' ), 'not_found_in_trash' => esc_html__( 'No case studies found in Trash.', 'e78' ), 'parent_item_colon' => esc_html__( 'Parent Case Study:', 'e78' ), 'all_items' => esc_html__( 'All Case Studies', 'e78' ), 'archives' => esc_html__( 'Case Study Archives', 'e78' ), 'attributes' => esc_html__( 'Case Study Attributes', 'e78' ), 'insert_into_item' => esc_html__( 'Insert into case study', 'e78' ), 'uploaded_to_this_item' => esc_html__( 'Uploaded to this case study', 'e78' ), 'featured_image' => esc_html__( 'Featured image', 'e78' ), 'set_featured_image' => esc_html__( 'Set featured image', 'e78' ), 'remove_featured_image' => esc_html__( 'Remove featured image', 'e78' ), 'use_featured_image' => esc_html__( 'Use as featured image', 'e78' ), 'menu_name' => esc_html__( 'Case Studies', 'e78' ), 'filter_items_list' => esc_html__( 'Filter case studies list', 'e78' ), 'filter_by_date' => esc_html__( '', 'e78' ), 'items_list_navigation' => esc_html__( 'Case Studies list navigation', 'e78' ), 'items_list' => esc_html__( 'Case Studies list', 'e78' ), 'item_published' => esc_html__( 'Case Study published.', 'e78' ), 'item_published_privately' => esc_html__( 'Case Study published privately.', 'e78' ), 'item_reverted_to_draft' => esc_html__( 'Case Study reverted to draft.', 'e78' ), 'item_scheduled' => esc_html__( 'Case Study scheduled.', 'e78' ), 'item_updated' => esc_html__( 'Case Study updated.', 'e78' ), 'text_domain' => esc_html__( 'e78', 'e78' ), ]; $args = [ 'label' => esc_html__( 'Case Studies', 'e78' ), 'labels' => $labels, 'description' => '', 'public' => true, 'hierarchical' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => false, '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' => true, 'rest_base' => '', 'show_in_menu' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-clipboard', 'capability_type' => 'post', 'supports' => ['title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'comments'], 'taxonomies' => [], 'rewrite' => [ 'slug' => 'case-studies', 'with_front' => false, ], ]; register_post_type( 'case_study', $args ); }
-
AuthorPosts
- You must be logged in to reply to this topic.