开发者

Wordpress Blog - How to hide Meta Widget to guest users

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜