Here, try this:
add_action( 'admin_bar_menu', 'remove_nodes_from_mysites', 999 );
function remove_nodes_from_mysites( $wp_admin_bar ) {
$user_blogs = get_blogs_of_user( get_current_user_id() );
foreach ( $user_blogs as $user_blog ) {
$wp_admin_bar->remove_node( "blog-" . $user_blog->userblog_id . "-n" );
$wp_admin_bar->remove_node( "blog-" . $user_blog->userblog_id . "-c" );
}
}
Related Posts:
- Function to return true if current page has child pages
- Cleaning up WordPress to improve performance?
- List of all theme customizer control types?
- Customize default settings on new sites on multisite
- Integrating WordPress to my website, while keeping my own authentication system
- Remove/unset options field from backend Settings->General?
- How to preserve PHP modifications while upgrading WordPress?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Change comments form title on a page by page basis
- Setting up the child theme so as to enable right-to-left WordPress?
- delete an array element when its date expires
- How to add default images into theme customizer image control?
- Overriding a theme redux file in child theme
- How to break down importing of feeds
- PHP can I add line numbers to file_get_contents()
- Setting custom canonical urls
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Converting HTML Template to WordPress Theme
- How to check if a meta value has already been assigned to any user?
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- How to pick the default selected value in wordpress dropdown?
- How to call plugin function per site in a multisite?
- Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
- Modify custom field input data before creating a new post
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Need help enqueueing webfonts
- Redirect to another page using contact form 7? [closed]
- Moving code from theme header to functions.php
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- wp_redirect only works on main site and not on other sites
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Create page template via functions.php?
- How to create a field in customize and show that in header.php?
- List all blogs, but exclude the main site
- List post by title length
- How do i wrap woocomerce attribute in list?
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Is there a hack for using is_page() within the function.php file?
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- Customize field names in backend profile edit page through function.php [duplicate]
- WP insert post Redirect after function has executed
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- bp-custom.php is not working on a WordPress multisite environment. how to fix it?
- WP-Bakery – Add custom colors to buttons with template colors
- Trying to update Woocommerce meta values
- update_user_meta as multiple value but with same meta key
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Delete post meta by serialized meta value
- Create form which redirects to site in network?
- Redirect user role to a specific page on login in a multisite network?
- Automatically refresh page if widget is added to page?
- PHP script to redirect traffic based on website accessed
- Where can I find the declaration of `$_wp_theme_features`?
- How do I routinely extract the thumbnail of the most recent post?
- use system script advertising in wordpress multisite
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Check if values exists DB
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to add button to top of theme customizer?
- How can I clear the theme mod settings?
- Display a list of users with avatar filterable with alphabets
- Custom PHP-coding in MU installs
- Select area and checkbox data is not saving?
- I need a button to appear when not loged in and another when logged in, I need help fixing code PLEASE!
- WP Custom tables query
- Add multiple HTML attributes to an Elementor button
- add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico
- Woocomerce custom add to cart button edit functionality [closed]
- How to change product title color in shop page if product has specific product tag (Woocommerce)?
- How to capture number input from wordpress form into acf field in woocommerce
- Restricting page by user role
- Sort registered users by post count? (inside admin dashboard)
- What is the fastest way to load PHP functions that are only used in one theme template?
- How to speed up admin-ajax.php in wordpress
- My Own layout in WooCommerce pages [closed]
- Getting rid of role=”navigation” in the Home Page Pagination
- PHP Deprecated: WP_RSSjb has a deprecated constructor
- Include a php file from functions.php only to homepage
- Placing raw HTML inside a WordPress shortcode
- Woocommerce – remove product from category
- How to use return in my custom function instead of echo
- Differences when using the the_time and the_date functions
- Create Logout Link WordPress Admin Menu
- Word Count Function Preventing Permalink Editing
- Add a Second Menu to a theme that only support 1 menu
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- How to speed up a wordpress function with multiple loops?
- How to Display Image Meta underneath EVERY image in EVERY post
- How do I implement a .diff changeset from core.trac.wordpress.org locally?
- Custom excerpt function re-factoring
- Adding tawk.to code just before body tag on functions.php file
- How to change a public function inside a class of a plugin?
- Custom php page outside the scope of my theme
- get_the_terms – only top level
- syntax issue on php 7.4
- How do I fetch all comments per post via WP REST API?
- How to get 2 or multiple custom post types in wordpress functions.php
- How do I publish only one page to production after making changes on staging?