問題描述

我剛剛更新了一個我的部落格到新的 wordpress 3.1,我需要隱藏顯示在頁面頂部的管理選單。我如何停用它?

謝謝

最佳解決方案

這是最簡單的方法。安裝 showhide-adminbar 。那麼所有訂閱者即使他們設定在檢視網站中也不會看到管理員。

http://wordpress.org/extend/plugins/showhide-adminbar/

次佳解決方案

前往 Dashboard> 您的個人資料> 顯示管理欄,取消選中 「檢視站點」

第三種解決方案

這將隱藏除管理員之外的所有使用者的管理欄。在 functions.php 結尾新增:

function my_function_admin_bar($content) {
    return ( current_user_can("administrator") ) ? $content : false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

第四種方案

將以下內容新增到主題的 functions.php 檔案中:

// Disable Admin Bar for all users
add_filter('show_admin_bar', '__return_false');

// Remove Admin Bar Options from all users' Profile page
add_action('admin_print_scripts-profile.php', 'hide_admin_bar_prefs');
function hide_admin_bar_prefs() {

?>
<style type="text/css">
    .show-admin-bar { display: none; }
</style>
<?php

}

參考文獻

注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。