71

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


69

The problem with @tollmanz answer is that since you're hooking off of the -print-styles and -print-scripts hooks, you must generate the HTML to load your scripts manually. This is not optimal, since you don't get the nice dependency and versioning that comes with wp_enqueue_script() and wp_enqueue_style(). It also doesn't let you put things in the footer if ...


66

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


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


26

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


19

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


17

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

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


15

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 parameter is omitted, ...


13

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'); }


13

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


12

I made this work iterating through a post types list, and pinpointing the correct $menu key for the post type using a secondary function (instead of manually iterating through the $menu object). Function reference: get_post_types and wp_count_posts. add_action( 'admin_menu', 'pending_posts_bubble_wpse_89028', 999 ); function ...


11

Doing this search, I've found this fine answer by Chris_O. There's even a jQuery solution I proposed there. Anyway, the function remove_menu_page('edit.php'); only removes the Posts menu. But, as we learn from Chris answer, remove_menu_page('edit.php?post_type=athletes'); removes the Custom Post Type menu. To really block access to the URL, as we're ...


11

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'); }


11

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

Yes, this capability is available with register_post_type, via the show_in_menu argument, but whether or not the particular plugin you are using supports this I don't know. add_action( 'init', 'wpa70679_custom_types' ); function wpa70679_custom_types() { register_post_type( 'parent_type', array( 'public' => true, '...


10

function remove_submenu() { remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=faq-topic&post_type=question' ); remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=faq-tags&post_type=question' ); } add_action( 'admin_menu', 'remove_submenu', 999 ); Please read the Codex. remove_submenu_page() need two parameters and the right ...


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

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


9

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


9

Use a submenu page as parent slug. The admin menu has just two levels, so the imaginary third level will be hidden. Sample code, tested: add_action( 'admin_menu', 'wpse_73622_register_hidden_page' ); function wpse_73622_register_hidden_page() { add_submenu_page( 'options-writing.php', 'Hidden!', 'Hidden!', 'exists', ...


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


9

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


9

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


9

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


8

I've not worked with the admin-bar before. However, I found your question interesting and decided to take a look. If you add a function to handle the action hook 'admin_bar_menu' and set the priority to be higher than 70, you will have access to the raw admin_bar_menu nodes where you can modify the properties you are trying to access. Below is a detailed set ...


8

You need to add your hook at the end of the queue and then remove menu by slug: function remove_menu_links() { if( !current_user_can( 'manage_options' ) ) { remove_menu_page( 'gf_edit_forms' ); // this is the pages url } } add_action( 'admin_menu', 'remove_menu_links', 9999 ); If you want to remove submenu you need to use following snippet: ...


8

Yes I recently ran into the situation where I wanted to change the profile link in the user-info section of the admin bar. The problem is that you can only get all nodes, add and remove them. Not edit. And you also cannot modify the $wp_admin_bar->nodes property due it is private. When easily removing and adding them, you'll lose your order and the whole ...


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.


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