开发者

Wordpress Blog - How to hide Meta Widget to guest users

开发者 https://www.devze.com 2023-02-06 07:46 出处:网络
In my web site the blog section created in word press, I want to hide the META widget to guest users, but it should be displayed in admin . I found the code in sidebar.php( wp-co开发者_高级运维ntent/t

In my web site the blog section created in word press, I want to hide the META widget to guest users, but it should be displayed in admin . I found the code in sidebar.php( wp-co开发者_高级运维ntent/themes/sidebar.php) page, but i don't know how to display this widget only for admin?

Please any one help me!!!!


You can determine if the current user is an administrator by checking if they have access to one of the admin-only privileges:

if ( current_user_can('manage_options') ) {
    //code to display your widget
}
0

精彩评论

暂无评论...
验证码 换一张
取 消