Roles
Show or hide widgets and sidebars based on WordPress user roles using this token:
[role:xyz]
– A specific user role, indicating the role’s key – for example:administrator, editor, contributor, author, subscriber
. Additional roles may be available depending on plugins installed.
Note that roles must be spelled with lower-case letters.
You can indicate one or more roles separated by comma. For example, to show a widget to subscribers and customers only, use:
[role:subscriber,customer]
You can also indicate several entries, each on a line by itself:
[role:subscriber]
[role:customer]
Groups
Show or hide widgets based on a user’s group membership with Groups.
[group:xyz]
– A specific group, indicating the name of the group. For example:Registered
(the default group for all users with an account on the site) and additional groups as defined.
Note that group names must be indicated exactly as they are named (correct lower and upper case spelling are important).
For example, show a widget only to registered users with [group:Registered]
or show a widget only to users in a Premium group using [group:Premium]
You can also show or hide a widget for more than one group, indicating group names separated by comma.
[group:Registered,Premium]
Alternatively, you can put each entry on a line by itself:
[group:Registered]
[group:Premium]
Let’s assume that you have created the Premium group and want to display the Archive widget only for users belonging to that group. To do so, select:
- Visibility:
Show only on these pages - Conditions:
[group:Premium]
Authors
To show or hide a widget only on author pages, you can use these tokens:
[author]
– Any author page.[author:xyz]
– A specific author’s page – indicate the user ID or username.