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

How to remove admin menu pages inserted by plugins?

You need to use the right hooks (which are not always the same as the URLs/slugs), and it doesn’t hurt to use a hook that runs later (e.g., admin_init): add_action( ‘admin_init’, ‘wpse_136058_remove_menu_pages’ ); function wpse_136058_remove_menu_pages() { remove_menu_page( ‘edit.php?post_type=acf’ ); remove_menu_page( ‘wpcf7’ ); } You can use the following to debug: add_action( ‘admin_init’, ‘wpse_136058_debug_admin_menu’ ); function … Read more

How do I Enqueue styles/scripts on Certain /wp-admin Pages?

add_menu_page and add_submenu_page both return the page’s “hook suffix”, which can be used to identify the page with certain hooks. As such, you can use that suffix in combination with the variable hooks admin_print_styles-{$hook_suffix} and admin_print_scripts-{$hook_suffix} to specifically target these pages. function my_menu() { $menu = add_menu_page( ‘Page 1’, ‘bar’, ‘something’, ‘else’, ‘foo’ ); $submenu … Read more