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 find cause of PHP notices with no stack trace?
- The correct method to pass query vars in AJAX using ajaxurl
- How to paginate a list of custom taxonomy terms?
- Display user’s total comment count outside The Loop
- wordpress separate registration for different roles
- How to get user by display_name with WP_User_Query
- Changing Link Attributes for Wp_Link_Pages
- Problem with Woocommerce REST API Authentication
- How to get custom image size for image uploaded in Customizer
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- How to change
- Get only the grandchildren, not the direct children of page/current page?
- Passing POST data from one WP post to another
- Use wp_remote_get to get JSON instagram feed from public profile
- How to add SVG icon above product tab title
- Call to undefined function issue
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- How can I generate random numbers inside my shortcodes on each implementation?
- custom widget on the footer
- How to create a custom category of wordpress admin
- WordPress automatically adding html tag around PHP code
- Customizer: Output default value in Customizer CSS
- Converting HTML Template to WordPress Theme
- How to hide all child pages with post_query?
- PHP Warning: chmod(): Operation not permitted in class-wp-filesystem-direct.php on line 173
- Saving an array of dynamic repeater data as post_meta
- How can I apply_filters from inside a function?
- Image rotation and editing stopped working in WordPress after upgrading Ubuntu from 16.04 to 18.04
- WordPress asks you for your FTP details if you want to run Automatic Updates/Upgrade Plugins
- Populate editor with some content of a page with a page template
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- get_template_part() not firing within a switch statement when template has new WP_Query
- get comment data using comment id
- how to get serialized post meta
- Can I set up a hover animation in CSS depending on a PHP conditional?
- WP check_ajax_referer() is not working
- How to access or parse key/values that have “string”
- Creating black and white copy of an image [closed]
- PHP code inside Shortcode
- Amend theme php to include certain category in header
- Add categorys to custom post type not working
- How to insert data from metabox to custom table
- call adminbar greeting in other place
- WP_LINK_PAGES Generating Unnecessary Tag
- Why is home page content not displaying with this rewrite rule?
- Call a function in functions.php from within tags (JS)
- Displaying images outside the content
- WordPress Conditional / Multiple Taxonomy Query
- Add class to ul and li in wp_na
- How can i programmatically change the SKU of a product based on product variation?
- Export post data with xml to other site using php soap
- PHP function for horizontal Woocommerce thumbnails and badges
- WooCommerce display price before add to cart [closed]
- How to route root path / to /xyz in nginx?
- Create dashboard widget for custom theme support
- The style.php file inside theme-engine folder has other content on FTP
- How to override html codes in wordpress?
- Insert data from form to database
- My search results are only showing 5 posts?
- WP_query meta_query slow with OR and DATES
- WordPress Query Crashes Browser
- How can I output the slug of a comment author?
- Matching multi user
- customizer live preview layout picker
- On a custom template, should I use wp_footer? [duplicate]
- Php conditional help needed
- Adapting a php array to WordPress
- Different layout on search page depending on category post
- WordPress and magic quotes
- Dynamically pull the correct email address from a match
- Help with if/else loop [closed]
- How to align buttons properly [closed]
- index.php file keeps redirecting to a non-existent index.html file?
- How to pass parameter to another url?
- HTTP 500 Error after Creating Shortcode
- Show button in header when product custom field is not empty
- WordPress PHP8 Critical Error in class-wp-widget.php
- How to get the last date updated of postmeta?