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

WordPress admin menu formatting issue

Otto has suggested a fix in Chrome itself until the bug is resolved: Go to chrome://flags/#disable-slimming-paint Enable the “Disable slimming paint” option. Ensure that the “Enable slimming paint” option below it is not turned on. Relaunch Chrome. If you don’t want to take this approach you can fix this with CSS: function chromefix_inline_css() { wp_add_inline_style( … Read more

Add a Separator to the Admin Menu?

Here’s a quick and dirty way to get what you want. Background WordPress stores admin menu sections in a global array called $menu. To add a separator you add an element to the $menu array using an index that is between the indexes of the options that you want to separate. Using the add_admin_menu_separator() function … Read more

Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu

Yes. When you register your post type you need to set show_in_menu to the page you would like it displayed on. Adding a custom post type as a sub-menu of Posts Here we set the “movies” post type to be included in the sub-menu under Posts. register_post_type( ‘movies’, array( ‘labels’ => array( ‘name’ => __( … Read more

Changing Admin Menu Labels

Here’s the process to change the labels (I changed posts to “contacts” in my example) function change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = ‘Contacts’; $submenu[‘edit.php’][5][0] = ‘Contacts’; $submenu[‘edit.php’][10][0] = ‘Add Contacts’; $submenu[‘edit.php’][15][0] = ‘Status’; // Change name for categories $submenu[‘edit.php’][16][0] = ‘Labels’; // Change name for tags echo ”; } function change_post_object_label() { global … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)