Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage Comments link in admin bar not hidden (multisite) #22

Open
jaxtheking opened this issue Nov 15, 2021 · 0 comments
Open

Manage Comments link in admin bar not hidden (multisite) #22

jaxtheking opened this issue Nov 15, 2021 · 0 comments

Comments

@jaxtheking
Copy link

I've installed the plugin and it works perfectly. However I realised that in multisite mode, the Manage Comments link in the toolbar menu for each site is not being hidden (however the linked page is properly redirected).
I am using the following to hide these links, and I thought you may add it to your plugin.

if ( is_multisite() ) {
  foreach ( get_sites() as $site ) {
    switch_to_blog( $site->blog_id );
    $blog_settings = get_option( 'factmaven_dsbl_general' );
    if ( is_array( $blog_settings ) || is_object( $blog_settings ) ) {
      if ( $blog_settings['comments'] == 'disable' ) {
        $wp_admin_bar->remove_node( "blog-{$site->blog_id}-c" );
      }
    }
    restore_current_blog();
  }
}

The code is to be added to the toolbar_menu function (called by the wp_before_admin_bar_render action) in includes/functions-general.php.
I tested it, it works well - not sure if there is a better method.
Luca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant