How to Add a Third Level Sub Menu to the WordPress Admin Menu

No, it is not possible to create third level menu in admin panel. If you look at the definition of add_submenu_page, you need to mention the parent slug name. For eg: add_menu_page ( ‘Test Menu’, ‘Test Menu’, ‘read’, ‘testmainmenu’, ”, ” ); add_submenu_page ( ‘testmainmenu’, ‘Test Menu’, ‘Child1’, ‘read’, ‘child1’, ”); The first parameter of … Read more

Custom Post Type Settings page, choose page to display archive

There is a dirty (actually dirty as hell) way to attach a ordinary WordPress page as archive page from a custom post type settings page. You need to unregister post type first, and create again. If you don’t use custom arguments or if you brave enough try this code. Add this code fragment end of … Read more

How to fix the admin menu margin-top bug in WordPress 5.5?

I ran into that issue too, and it turns out that it was because there actually was an error that wasn’t displaying. Once I fixed that underlying error, the top margin problem went away. This is in wp-admin/admin-header.php: // Print a CSS class to make PHP errors visible. if ( error_get_last() && WP_DEBUG && WP_DEBUG_DISPLAY … Read more

The Great WordPress Admin Menu Challenge of Jan 2011 (a.k.a. How to Resolve Some Challenges when Modifying the WordPress Admin Menu System?)

Mike, I’ve taken a look at the code and your ideal end use case … and some of them, frankly, aren’t possible with the current system. Again, your requirements: Get the “Microsite” submenu page to be highlighted when editing an Attorney Get the Attorney Menu Page link to link to /wp-admin/edit.php?post_type=attorney when editing an Attorney … Read more

How to remove entire admin menu?

The correct hook to use is admin_menu and then create a function to remove the menus you want to remove. The following 2 functions remove all the menus. add_action( ‘admin_menu’, ‘remove_admin_menus’ ); add_action( ‘admin_menu’, ‘remove_admin_submenus’ ); //Remove top level admin menus function remove_admin_menus() { remove_menu_page( ‘edit-comments.php’ ); remove_menu_page( ‘link-manager.php’ ); remove_menu_page( ‘tools.php’ ); remove_menu_page( ‘plugins.php’ … Read more

Adding a custom admin page

You need just two steps: Hook into the action admin_menu, register the page with a callback function to print the content. In your callback function load the file from plugin_dir_path( __FILE__ ) . “included.html”. Demo code: add_action( ‘admin_menu’, ‘wpse_91693_register’ ); function wpse_91693_register() { add_menu_page( ‘Include Text’, // page title ‘Include Text’, // menu title ‘manage_options’, … Read more

Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?

Positions for Core Menu Items 2 Dashboard 4 Separator 5 Posts 10 Media 15 Links 20 Pages 25 Comments 59 Separator 60 Appearance 65 Plugins 70 Users 75 Tools 80 Settings 99 Separator Parameter description for “menu position” $position (integer) (optional) The position in the menu order this menu should appear. By default, if this … Read more