Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Deactivate the adminbar per blog


pushi22le
Participant

@pushi22le

I found this plugin https://wordpress.org/extend/plugins/remove-buddypress-adminbar/

I also copied and edited the plugin to deactivate the bar just for guests. Here is the code:

<?php

/*

Plugin Name: Remove BuddyPress AdminBar For Guests

Plugin URI: http://blog.netweblogic.com/php/wordpress-php/remove-admin-bar-plugin/

Description: This plugin removes the admin bar completely from the public area of the website just for guests. Can be used either as a normal or MU plugin.

Author: NetWebLogic LLC

Version: 1.2

Author URI: http://blog.netweblogic.com

*/

if ( !function_exists(‘remove_bp_adminbar_guests’) ) {

function remove_bp_adminbar_guests() {

if (!is_user_logged_in()) {

remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );

remove_action( ‘wp_head’, ‘bp_core_admin_bar_css’, 1 );

function bp_core_override_adminbar_css_perblog() {

?>

<style type=”text/css”>body { padding-top: 0 !important; } #wp-admin-bar { display: none; }</style>

<?php

}

add_action( ‘wp_footer’, ‘bp_core_override_adminbar_css’ );

}

}

}

// Start this plugin once all other plugins are fully loaded

add_action( ‘plugins_loaded’, ‘remove_bp_adminbar_guests’ );

?>

So the bloggers have two options, they can deactivate the bar only for guests or also for the registered users.

Skip to toolbar