In this members-only tutorial, we shall
- add a custom function to check if the currently logged-in user has a specific WordPress role
- add a custom shortcode to not output elements based on user role using the above function
- use this shortcode in a Shortcode Wrapper element of Oxygen
[dont_output_for role="editor"][/dont_output_for], for example, will be output and shown to all users other than editors.
Step 1Install and activate Code Snippets plugin.
Step 2Go to Snippets > Add New. Title: Function to check if the user has a specific role Code:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.