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
- Enqueue Javascript Correctly for 3.5
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Add footer.php to WordPress child theme
- WooCommerce – Display variation custom field value [closed]
- Restrict WordPress File Type Uploads by User Type
- How to slow down server response
- Click loads template via ajax
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Use menu link or onClick to set a variable
- Automatically remove a canceled order in Woocommerce
- Create highly customized submenu (possibly using wp_list_pages)
- $wpdb->wp_users returning empty value for
- WordPress Custom field Colors
- Sending a custom form data in email through WP Mail Function
- How to add PHP code in functions.php wordpress
- how to changes mobile menu toggle breakpoint in WordPress
- Get page permalink in contact form
- How to display already created menus via php?
- Grabbing Image name From Product Image Gallery
- remove_action from parent theme using child theme functions.php
- Cant get blog name with get_option
- Extra editor on top of default in Custom Post Type
- Pagination 404 error(I have refreshed the permalinks and tried several previous options)
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- oembed facebook link?
- Open/closed function [closed]
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- site_url() returns with additional backslashes
- Overwriting a Shortcode
- WP multisite network plugin fails to see classes loaded with spl autoload
- Warning: Attempt to read property “term_id” on int – Woocommerce