WordPress.org

Ready to get started?Download WordPress

Forums

show something in the sidebar only for certain users (2 posts)

  1. monolog
    Member
    Posted 7 years ago #

    What's the code I should use to check if a user has a specific role to show something in the sidebar only for certain users?

    I want to show some links in my sidebar only for administrators...

  2. Kafkaesqui

    Posted 7 years ago #

    The user level (global var $user_level) should be available, so you can try testing on it:

    <?php
    global $user_level;
    if( 10 == $user_level ) :
    ?>
    <p>Hello Admin!</p>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic