WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Admin only links (5 posts)

  1. chommer
    Member
    Posted 3 years ago #

    Hello! Sorry for the seemingly simple question, I've searched both existing plug ins and the support documentation and haven't found a clear answer to this.

    Is there a way to place links in the sidebar that are only visible to someone logged in as an admin. These would be custom links defined by me and not links to the admin section of the dashboard.

    Thanks in advance!

  2. Helen Hou-Sandi
    WordPress Dev
    Posted 3 years ago #

    You might try the Widget Logic plugin to have a widget that only shows to an admin: http://wordpress.org/extend/plugins/widget-logic/

    The check for an admin would be something like current_user_can('administrator')

  3. chommer
    Member
    Posted 3 years ago #

    Worked perfectly, thank you!

    In case anyone else needs this, the actual syntax for widget logic should be:

    current_user_can('level_10')

    Thanks again!

  4. Helen Hou-Sandi
    WordPress Dev
    Posted 3 years ago #

    No problem! I'd avoid levels and maybe choose a capability, like 'manage_options' instead, but if it works for you, I'm sure you'll be happy! Be sure to mark this thread as resolved as well :)

  5. chommer
    Member
    Posted 3 years ago #

    Done. Thanks. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.