Attach CPT to submenu
-
I’m currently developing a plugin that is using a Custom Post Type. I’d like to register my CPT and put it under another sub-menu. For example, main menu is STORE and the sub-menu is PRODUCTS.
I followed the guide lines from this blog entry
How to add a custom post type into the sub-menu of a custom menu
and I am still unable to add a new CPT, I get the following error message:You do not have sufficient permissions to access this page.
Everything works perfectly if I use CPT with his top-level menu otherwise I can only read, delete and edit CPTs but I can’t add new ones.
What is the correct way to attach the CPT into the submenu PRODUCTS?
Here my php codefunction register_cpt() { if ( is_user_logged_in() && current_user_can( 'edit_others_products' ) ) { $show = false; } else { $show = true; } $args = array ( 'public' => true, 'hierarchical' => false, 'has_archive' => true, 'show_ui' => true, 'show_in_menu' => $show, ); register_post_type( 'mf_product', $args ); } function setup_menu() { add_menu_page( ... ); // menu_store add_submenu_page( 'menu_store', 'Product Editor', 'Product Editor', 'edit_others_prodcuts', 'edit.php?post_type=mf_product', NULL ); }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Attach CPT to submenu’ is closed to new replies.