15 votes

Changing Admin Menu Labels

To rename default post type (or any other for that matter) just use filter post_type_labels_{$post_type}. For default post it will be post_type_labels_post. In the code below is the full list of ...
Ivan's user avatar
  • 151
15 votes

remove_menu_page doesn't work on custom plugin menus

Place this below temporary code in your functions.php or any where that can be executed. add_action( 'admin_init', 'the_dramatist_debug_admin_menu' ); function the_dramatist_debug_admin_menu() { ...
CodeMascot's user avatar
  • 4,527
13 votes

How to limit wordpress menu depth in admin panel

The solution that I came up with: /** * Limit max menu depth in admin panel to 2 */ function q242068_limit_depth( $hook ) { if ( $hook != 'nav-menus.php' ) return; // override default value ...
jmarceli's user avatar
  • 1,066
12 votes

Remove Categories / Tags From Admin Menu

If you want to completely remove categories and tags you can do so like this: // Remove Categories and Tags add_action('init', 'myprefix_remove_tax'); function myprefix_remove_tax() { ...
Marc's user avatar
  • 721
12 votes
Accepted

How to add custom submenu links in wp-admin menus?

For the custom link into the admin menu, you need to pick up a top-level menu item by its slug and register the function using the admin_menu action hook. Here is the list of Main Admin Menu slugs. ...
Syed Fakhar Abbas's user avatar
11 votes
Accepted

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', '...
Karthikeyani Srijish's user avatar
10 votes
Accepted

How to remove items from +New admin menu?

To hide everything (menu and submenu)- function wpse_260669_remove_new_content(){ global $wp_admin_bar; $wp_admin_bar->remove_menu( 'new-content' ); } add_action( '...
mukto90's user avatar
  • 1,344
10 votes
Accepted

Hide Theme options and Customize Admin menu

Direct answer: add_action( 'admin_menu', function() { global $current_user; $current_user = wp_get_current_user(); $user_name = $current_user->user_login; //check condition ...
coolpasta's user avatar
  • 919
9 votes

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

Our custom post type: $args['show_in_menu'] = false; register_post_type('custom_plugin_post_type', $args); Add him for existing Custom Post Type ("product" for example): $existing_CPT_menu = 'edit....
ConConovaloff's user avatar
9 votes
Accepted

Custom WP_List_Table displays blank rows

You're getting the blank rows because your column headers are registered late. And you should register the headers (i.e. initialize the list table class instance) before admin notices are rendered on ...
Sally CJ's user avatar
  • 39.2k
8 votes
Accepted

remove_menu_page doesn't work on custom plugin menus

Thanks to the answer that the_dramatist posted, it was a matter of just hooking to the admin_init tag. The slugs for those plugin pages can be retrieved by the debug script that the_dramatist provided,...
Ethan O'Sullivan's user avatar
8 votes
Accepted

How to add notification bubble for my custom admin menu page

OK, so it has nothing to do with WP_List_Table, to be precise. All you need to do is to add some additional info during registration of your custom admin page. There are two classes used by WordPress ...
Krzysiek Dróżdż's user avatar
8 votes

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-...
RJR's user avatar
  • 81
7 votes

Appearance->Editor not visible

I had a similar problem (albeit 3 years later) and after some research I had a process for potentially identifying the source of the problem and subsequently found that my issue was hidden in a plugin ...
WPDavid's user avatar
  • 199
7 votes
Accepted

renaming an admin menu item with decimal array index number

You have to use a string as key: $menu['26.0648'][0] = 'Event Calendar'; If you write the key as a number, it will truncate the decimal to an integer, so 26.0648 will be truncated to 26.
ahendwh2's user avatar
  • 696
6 votes

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

As @mor7ifer mentioned above, you can use the native WordPress function get_current_screen(). If you loop through the output of this function, e.g.: $current_screen = get_current_screen(); foreach($...
recurse's user avatar
  • 173
6 votes

Why I can't change the permalink of this page?

Make sure to check the permalinks of YOUR IMAGES also (in "Media"->"Library") as they create a permalink ("post" type) if you upload an image with a filename that is ...
FirstFraktal's user avatar
6 votes
Accepted

Add menu page on multisite

I believe you're looking for the network_admin_menu hook. Here's how you'd use it: add_action('network_admin_menu', 'function_name'); function function_name() { add_menu_page( "...
Pat J's user avatar
  • 11.8k
6 votes
Accepted

How to change admin menu position of "Media"?

There's a combination of two filters, menu_order does the job, but you also use custom_menu_order to enable menu_order. function wpse_233129_custom_menu_order() { return array( 'index.php', '...
Andy Macaulay-Brook's user avatar
6 votes
Accepted

'Headers already sent' Error When Redirecting from add_submenu_page() Callback

Background The infamous "Headers already sent" error rears it's ugly head in circumstances where something attempts to modify the HTTP headers for the server's response after they have ...
bosco's user avatar
  • 6,805
6 votes
Accepted

Reorder custom submenu item

Got it, thanks to cjbj's help, I was able to get the final solution: add_filter( 'custom_menu_order', 'submenu_order' ); function submenu_order( $menu_order ) { # Get submenu key location based ...
Ethan O'Sullivan's user avatar
6 votes

add_menu_page() with function inside a class

add_action must be inside the plugin class and should look like add_action( 'admin_menu', array( $this, 'add_menu_items' ) ); Usually this line presents in the __construct() method.
KAGG Design's user avatar
  • 1,842
6 votes

Hide Theme options and Customize Admin menu

This would work in WordPress 5 add_action( 'admin_menu', function() { remove_submenu_page( 'themes.php', 'customize.php?return=' . urlencode($_SERVER['SCRIPT_NAME'])); });
FooBar's user avatar
  • 444
6 votes
Accepted

wrapping 'rest_api_init' in 'is_admin()' function

Essentially, you shouldn't wrap your REST route declarations inside is_admin() since Wordpress will not load them (see @DarkNueron comment). What you can do is pass a 'permission_callback' function to ...
floodlitworld's user avatar
5 votes

Remove query var on admin pages when 'Save changes' pressed

This might be useful: there is a filter called removable_query_args. You get an array of argument names to which you can append your own argument. Then WP will take care of removing all of the ...
AncientRo's user avatar
  • 366
5 votes
Accepted

How to limit wordpress menu depth in admin panel

Follow up on @jmarceli's and @squarecandy's great answers. Here is a solution that allows for: Easier scaling (set an object in the php action) Updates to the correct menu depth when the location ...
Davey's user avatar
  • 168
5 votes
Accepted

How do I set up a webhook?

You are using self-hosted WordPress, which sometimes referred to as WordPress.org. Calling remote hook is still a possibility there, but unless your e-commerce solution supports it, you may need to ...
Worduoso's user avatar
  • 271
5 votes
Accepted

Remove Pagination in Appearance -> Menus -> Categories

As per Stackoverflow Stackoverflow Ok after reading through the source code I found that the number of categories returned in the edit menu section is hardcoded to 50 on line 613 of \wp-admin\...
mad2kx's user avatar
  • 172
5 votes
Accepted

How to add Font Awesome 5 icons in WP Admin dashboard menu?

Just like with Font Awesome 4, you can enqueue styles in your theme to take effect on the admin pages. This allows you get styles needed for Font Awesome icons to be used. Just update your functions ...
mcphersonjr's user avatar
4 votes

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

Looking for a solution on the web but didn't found. Simply does this trick (for example). Here you have the native list of positions: 2 Dashboard 4 Separator 5 Posts 10 Media 15 Links ...
Nolan Crochot's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible