I am adding a submenu named as "Articles" using add_submenu_page() under a custom menu. I want to display the custom post type="page_article" in this "Articles" submenu.
Whenever I click on Articles submenu , it should redirect me to "edit.php?post_type="page_article".
I have tried with wp_redirect in callback function of add_submenu_page, but I am not getting.
Thanks
Probably i think you want to add a custom type post as sub-menu in WordPress dashboard. You can do.
add_action( 'admin_menu', 'my_plugin_menu' );
function my_plugin_menu(){
add_menu_page('Page title', 'Top-level menu title', 'manage_options', 'my-top-level-handle', 'my_menu_function');
add_submenu_page( 'my-top-level-handle', 'Custom Post Type Admin', 'Articles', 'manage_options','edit.php?post_type=page_article');
}
Don't forget to add below code while registering a custom type post
'show_in_menu' => 'edit.php?post_type=page_article'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With