WordPress yönetici çubuğunu yöneticiler hariç tüm kullanıcılar için devre dışı bırakmak mı istiyorsunuz?
Varsayılan olarak, WordPress yönetici çubuğunu bireysel kullanıcılar için kolayca devre dışı bırakabilirsiniz. Ancak sitenizde çok sayıda kayıtlı kullanıcı varsa bu işlem zaman alabilir.
Bu makalede, WordPress yönetici çubuğunu yöneticiler hariç tüm kullanıcılar için nasıl kolayca devre dışı bırakacağınızı göstereceğiz.
WordPress Yönetici Çubuğu Nedir?
WordPress varsayılan olarak, oturum açmış tüm kullanıcılar için ekranın üst kısmında bir yönetici çubuğu gösterir. Hesabınıza giriş yaptığınızda, bu araç çubuğunu WordPress yönetici alanında ve diğer tüm sayfalarda görebilirsiniz.
WordPress yönetici araç çubuğu, WordPress’in farklı arka uç alanlarına yönelik kullanışlı kısayollara sahiptir ve bu kısayollar kullanıcının WordPress’teki rolüne ve izinlerine göre değişir.
Ancak, web sitenizin ön ucuna bakarken yönetici çubuğu dikkat dağıtıcı olabilir.
Ayrıca web sitenizin tasarımını ve kullanıcı deneyimini de etkileyebilir. Üçüncü bir taraf için bir WordPress sitesi oluşturuyor veya yönetiyorsanız bu bir sorun olabilir, çünkü web sitelerinin gerçekte neye benzediğini görmelerini engeller.
Neyse ki, yöneticiler hariç tüm kullanıcılar için yönetici çubuğunu devre dışı bırakmanın birden fazla yolu vardır. Kullanmak istediğiniz yönteme atlamak için aşağıdaki hızlı bağlantıları kullanmanız yeterlidir:
Video Eğitimi
Yazılı talimatları tercih ediyorsanız, okumaya devam edin.
Yöntem 1: Bireysel Kullanıcılar için WordPress Yönetici Çubuğunu Devre Dışı Bırakın
Kullanıcı profillerini düzenleyerek belirli kullanıcılar için yönetici çubuğunu devre dışı bırakabilirsiniz. Yalnızca az sayıda kişi için çubuğu kaldırmanız gerekiyorsa bu hızlı ve kolay bir yöntemdir. Ancak, çok sayıda kullanıcısı olan bir üyelik sitesi işletiyorsanız, farklı bir yöntem seçmenizi öneririz.
Yönetici çubuğunu manuel olarak kaldırmak için WordPress yönetici panosundaki Kullanıcılar ” Tüm Kullanıcı lar sayfasına gidin. Ardından farenizi yönetici çubuğuna ihtiyaç duymayan kullanıcının üzerine getirin ve göründüğünde ‘Düzenle’ye tıklayın.
Bu, o kullanıcının profilini açacaktır.
Buradan, ‘Siteyi görüntülerken araç çubuğunu göster’ seçeneğinin yanındaki kutunun işaretini kaldırın.
Bundan sonra, ekranın en altına gidin ve değişikliklerinizi kaydetmek için ‘Kullanıcıyı Güncelle’ye tıklayın. Bu, yönetici çubuğunu yalnızca söz konusu kişi için devre dışı bırakacaktır.
Araç çubuğunu daha fazla kullanıcı için gizlemek için yukarıda açıklanan aynı işlemi uygulamanız yeterlidir.
Yöntem 2: Yöneticiler Dışındaki Tüm Kullanıcılar için Yönetici Çubuğunu Devre Dışı Bırakın (Önerilen)
Yönetici çubuğunu çok sayıda farklı kişi için gizlemeniz gerekiyorsa, her kullanıcının ayarlarını manuel olarak değiştirmek çok fazla zaman ve çaba gerektirecektir.
Bu nedenle, bir WordPress tema dosyası olan functions.php dosyasına kod ekleyerek yönetici çubuğunu devre dışı bırakmanızı öneririz. Bunu daha önce yapmadıysanız, WordPress’te kod parçacıklarının nasıl kopyalanıp yapıştırılacağına ilişkin kılavuzumuza göz atın.
Bazı kılavuzlar tema dosyalarını manuel olarak düzenlemenizi söyleyecektir, ancak bu yaygın WordPress hatalarına neden olabilir ve hatta web sitenizi tamamen bozabilir.
Bu nedenle WPCode kullanmanızı öneririz. En iyi kod parçacığı eklentisidir ve sitenizi riske atmadan WordPress’e özel kod eklemeyi kolaylaştırır.
Öncelikle, ücretsiz WPCode eklentisini yüklemeniz ve etkinleştirmeniz gerekecektir. Daha fazla bilgi için, WordPress eklentisinin nasıl yükleneceğine ilişkin adım adım kılavuzumuza bakın.
Eklenti etkinleştirildikten sonra Code Snippets ” Snippet Ekle bölümüne gidin.
Burada, sitenize ekleyebileceğiniz önceden hazırlanmış tüm parçacıkları göreceksiniz. Bu, yorumları tamamen devre dışı bırakmanıza, WordPress’in genellikle desteklemediği dosya türlerini yüklemenize, ek sayfalarını devre dışı bırakmanıza ve çok daha fazlasına olanak tanıyan bir parçacık içerir.
Bir sonraki ekranda, farenizi ‘Özel Kodunuzu Ekleyin (Yeni Snippet)’ seçeneğinin üzerine getirmeniz ve göründüğünde ‘Snippet kullan’ düğmesine tıklamanız gerekir.
Bir sonraki ekranda, kod parçacığı için bir başlık yazın. Bu sadece referans içindir, bu yüzden istediğiniz herhangi bir şeyi kullanabilirsiniz.
Ardından, ‘Kod Türü’ açılır menüsünü açın ve ‘PHP Snippet’i seçin.
Bunu yaptıktan sonra, aşağıdaki kodu editöre yapıştırmanız yeterlidir:
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
Bu kod, şu anda yönetici kontrol paneline bakmayan yönetici olmayan kullanıcıları tanımlar. Bu kullanıcılar için WordPress yönetici çubuğunu devre dışı bırakır.
Bundan sonra, sayfayı aşağı kaydırarak ‘Ekleme’ bölümüne gelin. Burada, kodun her yerde çalıştığından emin olmak için varsayılan ‘Otomatik Ekle’ yöntemini koruyabilirsiniz.
Son olarak, ekranın üst kısmına kaydırın ve ‘Etkin Değil’ kaydırıcısına tıklayarak ‘Etkin’i göstermesini sağlayın.
Ardından, kod parçacığını canlı hale getirmek için ‘Snippet’i Kaydet’ veya ‘Güncelle’ düğmesine tıklamanız yeterlidir.
İşte bu kadar! Her şeyin yolunda gittiğinden emin olmak için WordPress web sitenizi kontrol etmeyi unutmayın.
Yöntem 3: WordPress Yönetici Çubuğunu Yöneticiler Dışındaki Tüm Kullanıcılar İçin Devre Dışı Bırakın (Kod Gerekmez)
Web sitenize kod eklemek istemiyorsanız, bir eklenti kullanarak yönetici çubuğunu gizleyebilirsiniz. Hide Admin Bar Based on User Roles, araç çubuğunu farklı kullanıcı rollerine göre kaldırmanıza olanak tanır, bu nedenle çubuğu tüm üyeler, WooCommerce müşterileri veya başka bir kullanıcı rolü için devre dışı bırakmak istiyorsanız bu iyi bir seçimdir.
Öncelikle Hide Admin Bar Based on User Roles eklentisini yüklemeniz ve etkinleştirmeniz gerekir. Daha fazla ayrıntı için, bir WordPress eklentisinin nasıl kurulacağına ilişkin adım adım kılavuzumuza bakın.
Etkinleştirmenin ardından Ayarlar ” Yönetici Çubuğunu Gizle Ayarları sayfasına gitmeniz gerekir. Buradan, yönetici çubuğunu devre dışı bırakmak istediğiniz kullanıcı rollerinin yanındaki kutuları işaretleyin.
Bu işlem tamamlandıktan sonra, ayarlarınızı kaydetmek için ‘Değişiklikleri Kaydet’e tıklamanız yeterlidir.
Yöntem 4: Tüm Kullanıcılar İçin Yönetici Çubuğunu Devre Dışı Bırakın (Yöneticiler Dahil)
Site yöneticileri de dahil olmak üzere tüm kullanıcılar için yönetici çubuğunu devre dışı bırakmak istiyor musunuz?
Bunu, sitenizin genel sayfalarını görüntüleyen herkes için yönetici çubuğunu devre dışı bırakan bazı kodlar ekleyerek yapabilirsiniz. Bu, yönetici çubuğunun yalnızca WordPress kontrol paneli alanında olduğunuzda görüneceği anlamına gelir.
İşleri kolaylaştırmak için WPCode, yerleşik Kod Parçacığı Kitaplığında tam olarak ihtiyacınız olan kod parçacığına sahiptir. Basitçe Kod Parçacıkları “ Kütüphane‘ye gidin.
Burada, ‘WP Yönetici Çubuğunu Devre Dışı Bırak’ için arama yapın.
Doğru snippet göründüğünde, sadece ‘Snippet Kullan’ düğmesine tıklayın.
Eklenti kodu sitenize otomatik olarak ekleyecek, koda açıklayıcı bir başlık verecek, doğru ekleme yöntemini seçecek ve hatta snippet’i tanımlamanıza yardımcı olacak etiketler ek leyecektir.
İşte kodun nasıl göründüğü:
/* Disable WordPress Admin Bar for all users */
add_filter( 'show_admin_bar', '__return_false' );
Şimdi tek yapmanız gereken anahtarı ‘Etkin Değil’den ‘Etkin’e getirmek ve ardından ‘Güncelle’ye tıklamak.
Şimdi, WordPress hesabınızda oturum açmışken web sitenizin ön ucunu ziyaret ederseniz, yönetici çubuğu kaybolacaktır.
Umarız bu makale, WordPress yönetici çubuğunu yöneticiler hariç tüm kullanıcılar için nasıl devre dışı bırakacağınızı öğrenmenize yardımcı olmuştur. Ayrıca nihai WordPress güvenlik kılavuzumuzu ve herhangi bir kod kullanmadan özel sayfa düzenleri oluşturmak için en iyi WordPress sayfa oluşturucuları karşılaştırmamızı da görmek isteyebilirsiniz.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Destiny Boy says
This was very simple ans straight forward, it helped me
ronald osoo says
This code has bug , its working but not bullet proof . The normal user can by -pass this and get access to the user admin like panel at the top by just adding wp-admin/ to the url like trying to login
Math says
I agree, direct access to wp-admin/profile.php is making this useless.
Steve says
A lot of websites not only from wordpress have the same option. You can acces to the admin-login page of any website just writing example.com/admin : Thats normal. I find it’s look really good without the adminbar.
Alex S says
Hello,
I wish your syntax highlighter was better. Tried to copy the code and got the numbers starting at 2. I don’t need your numbers, just the good code. I would use this site a lot more if this was not the case.
Thanks.
WPBeginner Support says
You can also click on the little button on top right corner of the code snippet. It will open the raw code in a popup, which is much easier to copy.
Yönetici
stefano says
It works well, but the bar remains for visitors, who have not made the LOGIN
Jenn says
This plugin was working great and I was using Theme My Login. When I deactivated that plugin it is not not functioning as before… I see the admin bar for all users. Any suggestions?
Jenn says
Sorry I meant to say this ‘code’ was working great. I created a site-specific plugin as well and everything was working great. But after deactivating Theme My Login, not it seems to not have any effect and I see the admin bar on all users.
Suggestions?
Jenn says
I just tried adding in the code for all users: show_admin_bar(false); and I can still see the admin bar.
Alexander Pardo says
Thank you very much ! A very simple and clean solution.
Jason A. Churchill says
I’m not well-read in editing the functions.php file. My first two attempts resulted in syntax error messages.
Where exactly should I place this code in the functions.php file?
WPBeginner Support says
At the end. If your functions.php file ends with ?> then you need to paste the code just before it.
Yönetici
Terry Hale says
Thanks so much for this! No plugins, nice, clean, simple.
WPBeginner Staff says
WordPress admin bar is displayed only for logged in users.
Bhris says
Great straight-to-the-point tutorial.
Is there a version of the code that will block all non-users. That is, visitors to the site won’t see the bar, while all logged-in users would?
Shashi says
I was trying to do what what was mentioned in the article and it did not work. I used the following instead which did the trick from me:
if ( ! current_user_can( ‘manage_options’ ) ) {
show_admin_bar( false );
}
The above was mentioned in the wordpress codex: http://codex.wordpress.org/Function_Reference/show_admin_bar
vipin says
Thanks a lot its really cool…………
Karen says
Neither worked for me. I copied the numbers with the text as I did not know that I could![:-(](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E)
click on the button on top right corner of the code snippet and copy the raw code. I removed the numbers, but overlooked the seven. I had to change the file entry in via my file manager as I could no longer edit the functions.php. So after a scare and a bit of back and forth I removed the number and the admin bar is still there. I also tried your code Shashi, but it’s not working either.
I have tried every plugin under the sun and nothing will remove the bar.
kim04099 says
Thank You!!
Che Boielle says
Fastest fix to an odd issue I’ve ever found and implemented. Great explanation simple to follow instructions. Thanks guys, will be book marking your site.
Manthan says
Thanks, Its the easiest way found..!!!
Ryan McGovern says
Thanks for the code snippet!
Anup says
Why not simply do this for any specific user.
Jack says
It would be hard to do this if you have many users.
Róger Marroni says
Great job man!
thank you very much!
Mega says
I tried and my site is black.
Ryan S says
the first step works fine, it is something in your end, maybe while implementing the code
Etienne says
Perfect piece of code… Thanks a lot!
Cheers
Nathan Jansen says
Use this if you want this only for a certain role
function remove_admin_bar() {
$user = wp_get_current_user();
if (in_array(‘subscriber’, $user->roles)) {
show_admin_bar(false);
}
}
meef says
Godbless You. Answers to my problem always come from you post.
Thanks
Prem says
Finally I got the answers Thank you
Paw Pet Directory says
I used this on my directory for my customers but the bar will not go away for them. I am using 3.8 with AppThemes Vantage Theme (Latest)
Cory says
This is one of those things that, because it’s such a small customization, I’d hate to use a plugin for. So being able to throw this short piece of code into my child theme’s functions.php made me super happy. Thanks so much far sharing! Works like a charm.
Raman says
Thanks for posting it was useful.
Naveen says
I have added this code it is working fine, but if a user takes meta there is an option yo view the admin, if i click on this the admin page can see, how to avoid this, i dont want to give admin panel to the users, a user can edit the url and give /wp-admin also he can see the admin, i dont want both what will do for this?
Subodh says
Admin bar is hidden but now how can a user log out?
I am using bbpress forum and a plugin for users to log in via their Facebook account to join forum. But find no option for logging out.
WPBeginner Support says
A link to the logout or login can be provided into sidebar or menus. WordPress comes with a default widget called meta which has login/logout link. Or you can add one to your site’s navigation menus. See our guide on how to show different menus to logged in users
Yönetici
Loralee says
Thanks for the great tutorial. I thought it didn’t work – and then silly me I hadn’t followed the last step to activate my new plugin!! Thanks so much for this! So much better than installing multiple new plugins.
vikas says
Thanks mate….u were really helpful…
tc
Rajat says
Thx syed it just worked perfectly
Bongo says
Thanks for this, it helped me a lot
Andy Wagstaff says
I have an area of my site that requires log-in registration.
I have made the admin bar “autohide” by requiring a plug-in, I don’t want to entirely disable it, as I need the abiity to change password, but is there any way of removing items from the bar for users? I don’t want the site name,WP logo or the theme extensions options on the left hand side.
Is this possible? I am sure it is, but I can’t work it out!!
Ta!! Really handy site by the way
Andy
Rajiv says
Hi,
I want to disable BP Admin Bar for Logged Out Users.
Please help.
Ken Shoufer says
Hello,
Your code worked fine when I tried it locally on my computer, but when I tried it on a fresh WordPress install on my host server it would not let me log out. When I tried to log out, the address showing was “http://www.ken-shoufer.com/wordpress1/wp-login.php?action=logout&_wpnonce=9e7f51a307”.
I’m not sure what is wrong.
Editorial Staff says
That’s weird because we have it running on our live site.
Yönetici
Adrian says
Thanks!
Fabio Santos says
You can use this nice plugin instead: http://wordpress.org/plugins/global-admin-bar-hide-or-remove/
Nate says
i am trying to disable the W logo on the top left, the “My Sites” menu and the dashboard link on a buddypress multisite install. I want to keep the right side functional which shows the links to their buddypress profile settings. How can I achieve this?
Tanner Moushey says
To avoid the blank space where the admin bar was, call the function in the “after_setup_theme” action instead of “init”.
Cristian O. Balan says
Really perfect, thanks a lot!
Will says
Thank you so much! This worked perfectly and resolved several hours of head-scratching.
Cristian B. says
Really nice code. Are here also a fix to the blank bar that many here complains?
David says
Hi,
To avoid the blank, just instead of :
add_action(‘init’, ‘remove_admin_bar’);
use:
add_action(‘after_setup_theme’, ‘remove_admin_bar’);
Cristian O. Balan says
Thanks a lot man!
niki says
Fantastic! Except I also have the blank space visible where the admin bar would be. Does anyone have a fix for this?
Marlita Hill says
Hello. Thank you for this. How would I write the code if I only want the bar accessible to admin and contributors? I still do not want the contributors to have admin access to my backend.
Steve says
Well… it removes the admin bar but it´s still occupying the space meaning there´s too much space up there now. I´m not sure it´s supposed to be that way?
Adam says
worked …
Thanks a lot
Nick Cokas says
Add the code and worked perfect. However, the user still sees a white space above were the toolbar existed before. Any ideas to remove that.
Thanks
Toby Couchman says
Did you use a plugin to place all the necessary user stuff on the frontend?
My team recently built a site with similar requirements and I’d love to compare the processes.
Cheers
Toby
Mark Coleman says
Do not pass a role name to current_user_can(), as this is not guaranteed to work correctly. from
http://codex.wordpress.org/Function_Reference/current_user_can
just FYI
Editorial Staff says
Agreed. Just updated the code to make it into a function, and then adding it in via action.
Yönetici
Sally says
Excellent post thanks so much!
Took me under a minute and the bar was gone… forever… truly grateful.
Sally
x
Corey Freeman says
Thanks to this I have one less plugin bloating my site. Woo!
Delton Childs says
This is an awesome post. short, to the point and contained a useful snippet! Thank you so much!
I’m using the S2Member plugin also, I was very concerned about compatibility issues with plugin based solutions because of the various s2Membership Levels. This solutions is working wonderfully for me.
Thanks Again!
James Davis says
Hi Guys,
Just found this bit of code and it worked perfect for my site…
Thanks so much
Cheers
James
AKA The Fitness Blogger
glueckpress says
Nice. For Superadmins in a Multisite install it would read like if(!current_user_can(‘manage_network’)) //etc.