Is there a function way that I can hide a sidebar from other admins? Meaning they can't see it so they can't edit its content but it is still there?

I'm wanting to place my copyright, developed by footer in a sidebar via a widget so it will allow me to create more footers like this for various layouts, but I don't want the client to have access to this sidebar.

I know I can do it through a conditional css function, but is there a function I can do to achieve this without just using css? Something Wordpress native?

Similar Example:

function Hide_Admin_Bar() {
if (!current_user_can('My_User_Name_Here') && !is_admin()) {

Here is the solution I've used which is css based.

global $pagenow;
    if (in_array($pagenow, array('widgets.php'))) {

function Only_show_to_webmaster_user_things_by_css() {
    global $current_user;
    $username = $current_user->user_login;
    if ($username == 'Your_Username_Here') {
    else {
<style>#Sidebar_ID_Here{display:none !important;}</style>
| improve this answer | |

Try the Adminimize plugin. It lets you hide whole chunks of the admin screen and menus from certain user roles or even certain users.

If it doesn't do it directly (and I think it may not do this), then you could hook an action to sidebar_admin_page. The easiest thing there (although there are surely more elegant and WP native ways), would be to do a conditional test for the user not being you, and if so write out CSS or javascript to hide the copyright sidebar.

| improve this answer | |
  • Thanks Joel! I was able to achieve this some time ago with a conditional check and css. I didn't find any other way to do it yet. I also tried Adminimize back at that time and it didn't have the user based options but rather user role based options. I posted an example of my code above as the answer. – Fearless Mode May 13 '15 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.