Timeline for Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 10, 2021 at 7:44 | comment | added | Krys | Thanks for supplying this code. I added my cpt pages through the menu admin with creating sub-menu to my cpt archive page, but I like this programmatical way better. | |
May 26, 2017 at 15:59 | comment | added | TomeeNS | Sorry for repeating. In order for the submenu and paretn menu to stay highlighted you need to give WP some more information. Ok, the 'show_in_menu' parameter makes the submenu to be current/highlighted when 'my_post_type' is on the screen. Now, we need also to add another action, that will highlight the parent menu. You could try this: add_filter( 'parent_file', 'menu_highlight' )); function menu_highlight( $parent_file ){ global $plugin_page, $post_type; if ('my_post_type' == $post_type) { $plugin_page = 'edit.php?post_type=my_post_type'; // the submenu hook name } return $parent_file; } | |
Feb 26, 2015 at 22:08 | comment | added | Francisco Corrales Morales |
the show_in_menu attribute, didn't worked for me.
|
|
Aug 21, 2013 at 12:59 | vote | accept | Ari | ||
Aug 21, 2013 at 12:57 | comment | added | Ari | Hi thanks you! I had found the way to do it! But may be yours will give a better result! | |
Aug 21, 2013 at 12:24 | history | edited | epilektric | CC BY-SA 3.0 |
refined the answer overall
|
Aug 21, 2013 at 11:58 | comment | added | epilektric | I've update my answer with a way to include taxonomies. | |
Aug 21, 2013 at 11:57 | history | edited | epilektric | CC BY-SA 3.0 |
added info on including submenu pages for taxonomies
|
Aug 18, 2013 at 18:00 | comment | added | Ari | Hi, thanks. It works. But the sub menu cpt lost its submenu. | |
Aug 18, 2013 at 17:29 | history | answered | epilektric | CC BY-SA 3.0 |