Display Specific Content for Admin Only in WordPress can be done easily, all need to do just write some if else statement with same parameter. On this example I will show you how to display simple stats from WordPress and display it in front page. Like on our previous WordPress tricks, we need to tweak on theme files, on this tricks we will play around with footer.php, it’s because I want display this information on the footer area.
<?php global $user_ID; if( $user_ID ) : ?>
<?php if( current_user_can('level_10') ) : ?>
<?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?>
<?php endif; ?>
<?php endif; ?>
On Display Content for Admin Only code above what we have done is checked if current user logging has level_10, if the user have this level, the content will be displayed. if the user below or didn’t logging, nothing to displayed. It’s easy right? You can explore this tricks and add more expert featured




Pingback: How to Show Data for Registered/Logged User only # WordPress Tricks & Tips
Pingback: wp-popular.com » Blog Archive » How To Display Specific Content for Admin Only in WordPress # WordPress Tricks
Pingback: 显示登录用户可见信息 | IT博客聚合
Fantastic solution!
With this hint there, you can, for example, set for employees only see parts of the site, and other administrators only.
I configured so that users registered as “collaborators”, Level 1, may see an area of the site, and another level 10, only I can see.
Very cool tip, congratulations!