📜  隐藏订阅者的 wp 管理栏 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:02.576000             🧑  作者: Mango

代码示例2
/* 
* Add this to the bottom of your functions.php file to hide the wp admin
* bar for all users except those whom can edit posts.
*/

add_action('set_current_user', 'cc_hide_admin_bar');
function cc_hide_admin_bar() {
  if (!current_user_can('edit_posts')) {
    show_admin_bar(false);
  }
}