76

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 ...


74

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' => __( '...


31

From the docs on add_submenu_page(), you see that you can hide your submenu link from a top level menu item to which it belongs be setting the slug (1st argument) to null: add_action( 'admin_menu', 'register_my_custom_submenu_page' ); function register_my_custom_submenu_page() { add_submenu_page( null, 'My Custom Submenu Page', ...


27

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() { ...


19

You probably need to set the add_action priority to a higher number and target those two new links specifically like so: add_action( 'admin_menu', 'my_remove_menu_pages', 999 ); function my_remove_menu_pages() { remove_menu_page( 'edit.php' ); //Posts remove_menu_page( 'upload.php' ); //Media remove_menu_page( 'edit-...


17

// PLUGINS THAT ADD AS DASHBOARD SUBMENU // IF THIS IS THE URL BELOW - THE PAGE VARIABLE IS WHAT I NEED ( SO WHATEVER COMES AFTER PAGE= ) // http://example.com/wp-admin/index.php?page=iconize-plugin-update-notifier remove_submenu_page( 'index.php', 'iconize-plugin-update-notifier' ); // OR FOR EXAMPLE WOOCOMMERCE DASHBOARD SUBMENU ...


16

add_action('admin_menu', 'my_remove_sub_menus'); function my_remove_sub_menus() { remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=category'); remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=post_tag'); }


14

You have some messed up code. I have reformatted your code to code which actually works. The following solution allows you to give your Custom Post Type menu a menu name of what ever you want. Just change the label "menu_name". POST TYPE // Create the news custom post type register_post_type('nwcm_news', array( 'labels' => array( '...


13

customize should work. I was able to remove the Customize link with the following code: add_action( 'wp_before_admin_bar_render', 'wpse200296_before_admin_bar_render' ); function wpse200296_before_admin_bar_render() { global $wp_admin_bar; $wp_admin_bar->remove_menu('customize'); }


12

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 labels (WP 4.7.1). You do not have to change everything. add_filter( 'post_type_labels_post', 'news_rename_labels' ); /** * Rename default post type to news * * @...


12

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() { echo '<pre>' . print_r( $GLOBALS[ 'menu' ], TRUE) . '</pre>'; } Then search for the plugin-slug. In which array you find it copy the [2] value ...


11

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. index.php => Dashboard edit.php => Posts upload.php => Media link-manager.php => Links edit.php?post_type=page => Pages edit-comments.php => ...


10

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() { register_taxonomy('category', array()); register_taxonomy('post_tag', array()); }


10

I am less convinced that I know what you are doing than I once was. // Add menu and pages to WordPress admin area add_action('admin_menu', 'myplugin_create_top_level_menu'); function myplugin_create_top_level_menu() { // This is the menu on the side add_menu_page( 'MyPlugin', 'MyPlugin', 'manage_options', 'myplugin-top-...


10

I did same error first time I implemented WP_List_Table. The problem is that when you call WP_List_Table::display() WordPress in turn calls: WP_List_Table::display_rows_or_placeholder() WP_List_Table::display_rows() WP_List_Table::single_row() WP_List_Table::single_row_columns() Last function is called for every row. If you look at its code (see source), ...


10

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 the ...


10

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 right after 'nav-menu' JS wp_add_inline_script( 'nav-menu', 'wpNavMenu.options.globalMaxDepth = 1;', 'after' ); } add_action( 'admin_enqueue_scripts', '...


10

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( 'wp_before_admin_bar_render', 'wpse_260669_remove_new_content' ); To hide specific menu/submenu item(s)- function wpse_260669_remove_new_content_items(){ global $wp_admin_bar; ...


9

Update I created a code snippet with a more robust function that deals with both main menus and sub-menu items. Original answer Instead of specifying the menus you want to remove, specify the menues you want to keep :) add_action('admin_init', 'nwcm_admin_init'); function nwcm_admin_init() { // Remove unnecessary menus $menus_to_stay = array(...


9

Here's an example of the data returned from the wp_get_update_data() function: Array ( [counts] => Array ( [plugins] => 3 [themes] => 2 [wordpress] => 0 [translations] => 0 [total] => 5 ) [title] => 3 Plugin Updates, 2 Theme Updates ) So the number of ...


8

It's commonly activated through: add_filter( 'pre_option_link_manager_enabled', '__return_true' ); The suggested Link Manager plugin only contains this code line.


8

Working code for adding widget to wp dashboard with information from custom DB: /** * Add application widget to the dashboard. */ function addApplicationWidget() { wp_add_dashboard_widget( 'submitted_applications', 'Submitted Applications', 'showApplicants' ); } add_action( ...


8

Add this to your theme's functions.php: add_action( 'admin_bar_menu', 'make_parent_node', 999 ); function make_parent_node( $wp_admin_bar ) { if ( ! is_admin() ) { return; } // end function if not in admin back-end, credit @Rarst $args = array( 'id' => 'view-site', // id of the existing child node (View Site) 'title' => '...


8

Or this more compact one will do the same : add_action( 'admin_bar_menu', 'remove_some_nodes_from_admin_top_bar_menu', 999 ); function remove_some_nodes_from_admin_top_bar_menu( $wp_admin_bar ) { $wp_admin_bar->remove_menu( 'customize' ); } Regards


8

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, or you can simply look at that query value after admin.php?page=plugin-slug: add_action( 'admin_init', 'wpse_243070_hide_menu' ); function ...


7

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.php?post_type=product'; $link_our_new_CPT = 'edit.php?post_type=custom_plugin_post_type'; add_submenu_page($existign_CPT_menu, 'SubmenuTitle', 'SubmenuTitle', '...


7

Normally everything is contained in $labels['menu_name'] argument on cpt registration is printed in the menu, so the right place where put the count span is there, but there are 2 problems: You have to dinamically count posts, so you can't just write there the html Even if you insert the html in the $labels['menu_name'] option or registration, the span is ...


7

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 (iThemes Security in may case). The missing Appearance > Editor in Wordpress could be due to a number of potential causes. A process to identify the source of ...


7

<?php if (!function_exists('debug_admin_menus')): function debug_admin_menus() { global $submenu, $menu, $pagenow; if ( current_user_can('manage_options') ) { // ONLY DO THIS FOR ADMIN if( $pagenow == 'index.php' ) { // PRINTS ON DASHBOARD echo '<pre>'; print_r( $menu ); echo '</pre>'; // TOP LEVEL MENUS ...


7

Remember Apple's "Goto Fail"? Similar situation: Your code actually does this, when indentation is corrected: foreach ( $post_types as $post_type ) remove_meta_box('trackbacksdiv', $post_type, 'normal'); remove_meta_box('postcustom', $post_type, 'normal'); remove_meta_box('authordiv', $post_type, 'normal'); remove_meta_box('postexcerpt', $...


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