[Plugin: Widget Logic] Admin only widgets? (5 posts)

  1. Aces1
    Posted 8 years ago #

    Is there a way of using the Widget Logic plugin to show a widget only for admin level users...

  2. alanft
    Posted 8 years ago #

    you could use current_user_can('capability')

    i think capability can be an old fashioned admin level type integer or the more modern capabilities. have a look at


  3. Aces1
    Posted 8 years ago #

    I don't see how...

    The roles and capabilities seems to relate more to the admin panel and editing, not viewing pages..

    It must be possible somehow....

  4. alanft
    Posted 8 years ago #

    nonetheless, the current_user_can function should work when displaying pages and posts. current_user means the logged in ID.

    i have used it to show extra post information viewable only by logged in site editors.

    try it. make an admin and non-admin user, and just try adding some widget logic that uses that function.

  5. Aces1
    Posted 8 years ago #

    wow! it works....

    had a look here

    then just added current_user_can('level_10') and it works.....

    Thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic