Hi, I wonder how to hide the WordPress black top bar from users after they logging in? There is no need for users to access to the control panel from the top bar. Thanks!
-
This topic was modified 8 years by
sunnydream.
I tried to paste this into functions.php
add_action(‘after_setup_theme’,’remove_admin_bar’);
function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()){
show_admin_bar(false);
}
}
It works very well on the mobile theme. But on the desktop, it’s not working at all.
-
This reply was modified 8 years by
sunnydream.
So sorry I didn’t realize that I need to edit the functions.php for both mobile and desktop. They both work great now! Thanks!
Google ‘how to make your own WordPress plugin’
basically you can just create a plugin per the simple docs on WordPress.org in the ‘codex’ and then you just put the functions in there, upload to plugin folder, activate… ta da.
Really simple.
e.g.,
<?php
/*
Plugin Name: Better Example
Plugin URI: http://wordpress.org/#
Description: Undoing the Madness
Author: Everett's sometimes obnoxious Twin
Version: 0.7
Author URI: http://theonion.com/
*/
function safe_print() {
print " -------- I think I'm getting a clue!";
}
/* End of File */