Skip to content

Instantly share code, notes, and snippets.

@devinsays
Last active February 7, 2021 15:16
Show Gist options
  • Save devinsays/c45d35e2a7020d47833e to your computer and use it in GitHub Desktop.
Save devinsays/c45d35e2a7020d47833e to your computer and use it in GitHub Desktop.

Revisions

  1. devinsays renamed this gist Nov 4, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. devinsays created this gist Nov 4, 2015.
    10 changes: 10 additions & 0 deletions hide-adminbar.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    <?php
    /**
    * Disables the #wpadmin bar for users without "edit_posts" permissions.
    */
    function prefix_hide_admin_bar() {
    if ( ! current_user_can( 'edit_posts' ) ) {
    add_filter( 'show_admin_bar', '__return_false' );
    }
    }
    add_action( 'after_setup_theme', 'prefix_hide_admin_bar' );