I need to show some info only to admins visiting a page, so I need a conditional tag to identify them. So far I have found:
<?php if ( current_user_can('manage_options') ): ?>
is this the correct function?
|
I need to show some info only to admins visiting a page, so I need a conditional tag to identify them. So far I have found:
is this the correct function? |
|||
|
Yes, that's good. You can be a little safer using |
|||||
|
|
I think it is better to check for role rather than specific capability for such purpose, this should work:
See Roles and Capabilities in Codex. |
|||||||
|
manage_optionswon't necessarily change, because a role will need that cap to set things such as thesite_url.. I'd personally opt for using what you have posted.. – t31os Nov 18 '10 at 12:46