The admin bar is hooked incorrectly.It should be hooked to wp_before_admin_bar_render
.
This is what I use (and works):
function alter_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( 'customize' );
$wp_admin_bar->remove_menu( 'ddw-gravityforms-toolbar' );
$wp_admin_bar->remove_menu( 'members-new-role' );
$wp_admin_bar->remove_menu( 'new-media' );
$wp_admin_bar->remove_menu( 'new-post' );
$wp_admin_bar->remove_menu( 'new-user' );
$wp_admin_bar->remove_menu( 'wp-logo' );
}
add_action( 'wp_before_admin_bar_render', 'alter_admin_bar' );
Regarding the side menu I don’t know. My first guess would be that you’re using incorrect identifiers.
Related Posts:
- How to fix the admin menu margin-top bug in WordPress 5.5?
- Remove Customize Background and Header from Appearance admin menu without CSS or JS
- renaming an admin menu item with decimal array index number
- Admin Menus – Name Menu different from first Submenu [duplicate]
- How to Add a Link to the Drop-Down User Menu in the Admin Bar?
- Create Logout Link WordPress Admin Menu
- Why use the Settings API over a new administration menu?
- Pagination in plugin’s backend
- Change order of custom submenu link in WP Admin?
- how to save checkbox data for custom setting?
- Admin submenu issue with PHP not detecting two strings as equal
- admin-ajax GET response bad request
- Remove submenu item from list
- Admin Menu new tab external link
- Add Admin Option w/ Anonymous Function
- add menu page in loop menu order
- Issue with search form admin panel after PHP migration
- WP Admin Bar – Get current theme name as custom menu title
- admin menu naming
- How to call a certain object/menubar in a PHP file
- Add Woocommerce Customers link to custom admin menu
- How to access admin menu labels and links on front-end?
- Only show image from custom field when present
- Cinema site, retrive the movies that actor play in
- How to include custom code on a page that’s set to act as homepage?
- retain querystring values when savincustom options in admin
- PHP if statement works in template files, but not header
- How Can I Edit the Registration Code?
- Error while setting role
- Editing a PHP file to include a small text piece on every page
- Get categories names as an array to use it in theme settings
- Should i use the wordpress Options table or to create database table..?
- variable value disappears in a second loop
- Force Users To Relogin
- unknown issue in ‘header.php’ preventing theme from displaying fully
- Hide a div to subscribers(user role) in one page (is_page)
- Security updates to 3.3.2
- Where is this function’s callback getting its arguments from?
- How can I use a sliced image As banner? [closed]
- persist a variable set in header.php all the way down to footer.php
- Echo title attribute php
- Can a page contain php code?
- Last class on last headline?
- Unable to Find Space in Custom Function
- Is it possible to display a DIV to not logged in users and then change it for users who are logged in?
- Strip Paragraph Tag
- Unable to process php via shortcode
- working with term_relationships table
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- Creating a mobile site by adding a new class to the body tag from functions.php
- WordPress plug-in for dynamic download link?
- Using WP functions such as the_title() in an included php file
- GET problem in WordPress
- WordPress gallery shortag
- Almost Done… Post Format Code
- wordpress admin plugin menu custom css
- Help with page nav?
- Show recent posts starting at a specific number archive
- Add title=”” to A PHP Code
- Get Page ID from Backend
- Help with WordPress function inside a shortcode
- Wpdb->insert() doesn’t insert new row after the last one
- WordPress plugin admin page – using WordPress function in linked php file
- HTML table attributes ignored
- What’s the best way to include PHP code in pages?
- Is there any wordpress plugin to upload images and captions to multiple pages once
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- PHP in Edit Post link
- Removing the first 8-10 letters from a post?
- How to add drag and drop functionalities to a div inside option panel
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Timthumb.php image gallery not working on Multisite WordPress
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- How do you create two separate Register pages?
- $_GET[‘updated’] does not work in WordPress 3.1?
- Why doesn’t PhotoSmash plugin play well with wp_query?
- How to send form data from WordPress (Meta Box) to an OData service?
- How to Configure Events List in WordPress to Disappear Event Once Date is Past
- Removing WordPress Footer -without access to PHP code?
- dynamic page using php from sql database
- Upload non-featured image to image field
- Usage of call back function of add_meta_box()
- Building a REST API for your web app exposes primary keys of DB records?
- WordPress get_media_embedded
- Change product_base programmatically
- wp_delete_comment takes two tries to delete – then deletes all comments
- php redirect with custom user roles set and working but redirect not working for when users are logged in
- how to get serialized post meta
- Hide Heading if ACF Field is empty
- Scheduling an event inside plugin class is not working
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- How to set a template with wp_insert_post
- WordPress Custom SQL Table with UserID Filter for results
- Automatically add images to a menu
- Display Yoast meta-description `wpseo_desc` within loop of categories and fail silently if no data is set [closed]
- Get access to variable from previous pageview, excluding ajax-calls
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Permission callback to check if user has application password
- Load Posts on Click via Ajax into a DIV
- How to catch wordpress post ID when it’s published