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)?
- Restricting page by user role
- Running WP Cron on multisite the right way
- Best way of adding CSS which can be manipulated by the user via theme option panels?
- Delete pages and Create default pages for all new network sites
- Modifying Footnote Plugin for Descriptive Title Attributes
- syntax issue on php 7.4
- get a simple array of all of the term names that exist in all taxonomies
- How to store data from multiple forms using ajax and php
- How to control WordPress image metadata (using Imagick)?
- Extend plugin Class through functions.php
- Output custom field value to post string
- Query Pages and post excerpts dynamically
- Get my site session in wordpress?
- Change order of custom submenu link in WP Admin?
- Register a menu – Error Header
- Set site title & tagline with wp.config or function.php
- Get user custom field value on function.php
- WordPress homepage setup not working on first load
- Dynamically Generate Functions and Hooks
- how to add datas in taxonomy to post with wp_insert_post
- Need help for some PHP code
- Adding HTML Code to Replace Text in PHP
- PHP “warning include_once(): Failed to open stream” Simple HTML DOM in WordPress Child Theme
- cURL needing to loop through all “next_page”
- How can I get my pagination loop to display the correct number of total pages?
- Get posts by id using shortcode
- Is it possible to replace ‘attachment’ with another word?
- List all blogs apart from the current blog and main blog in WordPress Multisite
- Break a WordPress function to run in patches and re-continue