Title: Shortcode for loggedin users not working correctly
Last modified: January 19, 2024

---

# Shortcode for loggedin users not working correctly

 *  Resolved [azraelGG](https://wordpress.org/support/users/azraelgg/)
 * (@azraelgg)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/)
 * Hi,
 * I am trying to setup rule for loggedin users and for some reason I am getting
   wrong result.
 * I set up RUA -> Add new (name: Loggedin Users) -> Members (Automations) ->Include
   user for as long as they are **Logged-in**
 * After that on my page builder I set ShortCode like this
 * `[restrict level="loggedin-users"]
   Block element 1 [/restrict][restrict level
   ="!loggedin-users"]Block element 2[/restrict]
 * When I am loggedout I get “Block element 2” (expected and working)
   BUT when I
   am logged in I get “Block element 1” and “Block element 2” (NOTE: I am expecting
   only “Block element 1” to show up)
    -  This topic was modified 2 years, 5 months ago by [azraelGG](https://wordpress.org/support/users/azraelgg/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/#post-17358564)
 * Thank you for reporting this and for the details.
 * Edit:
 * After being able to reproduce this problem at first, I realized that the level
   name I used in the shortcode was wrong.
 * Can you double check that you are using the level name exactly as it’s displayed
   in the Access Levels overview? And e.g. not the title, no whitespace, no uppercase
   letters etc.
    -  This reply was modified 2 years, 5 months ago by [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/).
 *  Thread Starter [azraelGG](https://wordpress.org/support/users/azraelgg/)
 * (@azraelgg)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/#post-17361635)
 * yes, I copy-paste it will do it here as well
 * from RUA Level name “loggedin-users”
   [restrict level=”loggedin-users”][restrict
   level=”!loggedin-users”]
 * will try with another name, not sure why is this happening
 *  Thread Starter [azraelGG](https://wordpress.org/support/users/azraelgg/)
 * (@azraelgg)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/#post-17361680)
 * no luck. I put the code inside shortcode link to img [https://ibb.co/pZ3VPWC](https://ibb.co/pZ3VPWC)
 * ![](https://ibb.co/pZ3VPWC)
    -  This reply was modified 2 years, 5 months ago by [azraelGG](https://wordpress.org/support/users/azraelgg/).
 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/#post-17368468)
 * Are you by any chance using an administrator user to test the shortcodes?
 * Administrators will always have access to all content by default. This can be
   changed with a wp filter, but is done to prevent lockout and cases where other
   users potentially could hide content from admins.
 * You can use a plugin like [https://wordpress.org/plugins/user-switching/](https://wordpress.org/plugins/user-switching/)
   to easily test how the site looks for different users.
 * Let me know if that isn’t the issue
 *  Thread Starter [azraelGG](https://wordpress.org/support/users/azraelgg/)
 * (@azraelgg)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/#post-17368859)
 * this was the case, thanks for clarify, I was not aware of it
 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/#post-17380143)
 * I am happy to hear that is all it was! I will try to see if I can make it more
   clear that administrators always have access to everything, all suggestions are
   welcome 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Shortcode for loggedin users not working correctly’ is closed to new 
replies.

 * ![](https://ps.w.org/restrict-user-access/assets/icon-256x256.png?rev=1815922)
 * [Restrict User Access - Ultimate Membership & Content Protection](https://wordpress.org/plugins/restrict-user-access/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-user-access/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-user-access/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-user-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-user-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-user-access/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 6 replies
 * 2 participants
 * Last reply from: [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/shortcode-for-loggedin-users-not-working-correctly/#post-17380143)
 * Status: resolved