User Role Condition

Display dynamic content based on the various user roles on your site.

In this article: About the User Role condition | How to set up the condition using If-So

What is the User Role Condition?

If-So automatically pulls the list of user roles from your WordPress site and adds them to the dropdown menu of the User Role condition.

Custom User Roles (Created by Third-Party Plugins)

Custom user roles created by third-party plugins will automatically appear on the condition’s user roles list for you to choose from.

How to set up a User Role condition

  1. On your WordPress dashboard, go to “If-So → Add New Trigger”.
  2. Click on “Select a condition” and select “User Role”.
  3. Select the role for which you want to create dynamic content.
  4. In the content field, set the content to be displayed if the condition is met.
  5. In the default content field, set content to be displayed if the condition is not met (optional, can be left blank).
  6. Press “Publish” and paste the shortcode anywhere you want on your site.
  1. Download and activate the If-So Dynamic Content WordPress plugin and the Conditional Elementor elements integration.
  2. In the Elementor editor, select the element you want to display based on user roles.
  3. In the element settings panel, go to the If-So tab.
  4. Choose the User Role condition and select the role for which you want to create dynamic content.
  5. Click Publish to save the page.
  1. Download and activate the If-So Dynamic Content WordPress plugin.
  2. In the Gutenberg editor, select the block you want to display based on user role.
  3. In the block settings sidebar, open the If-So Conditions panel.
  4. Choose the User Role condition and select the role for which you want to create dynamic content.
  5. Click Update to save the page.

Screenshots

1 16
Select the User Role condition

2 16
Select the operator
3 18
Select the role
4 15
Set the dynamic content

5 14
Set the default content
6 10
Paste the shortcode

FAQs

  • Does If-So work with caching plugins and server-side caching?

    Yes.

    Whether you are using a caching plugin or server caching, you can navigate to the plugin settings and enable the “Page Caching Compatibility” option.

    With the option enabled, dynamic triggers will be rendered in a separate request that will take place after the loading of the cached version.

    Learn more about Page Caching Compatibility.

  • Is it possible to set up conditional redirects (redirecting users to different pages based on conditions)?

    Yes, you can set up conditional redirects based on any If-So condition.

    For a step-by-step guide, click here.

Didn’t find what you need?

Spring Sale!

Up to 40% Off