This plugin provides a shortcode to display a portion of a post content only to users of a specific role. For example, you can show the hidden text to Editors or to Authors or to any other WordPress role.
Please, note that an Administrator can read an Editor private content or a Subscriber private content, and so on. Same thing for Editor, Author, Contributor, and Subscriber: a higher role can read a lower role content.
Also you can show the hidden text only to a certain role. For example, you can mark a text as visible only to Contributors and hide it to higher roles, such as Administrators or Editors and so on.
As of version 3.0 you can mark a text as visible only to a certain user, using his login name.
As of version 4.0 you can mark a text as visible to multiple users, using their login names comma separated.
As of version 4.3 you can use either the usual
private shortcode or the extra
ubn_private, in case the first is already in use.
As of version 5.0 you can use the new option
reverse to change the logic of the
recipient option. If
reverse is activated, it will not allow users in recipient read the private note.
Display this text to Administrators:
Display this text to Administrators and Editors:
Display this text to Administrators, Editors, and Authors:
Display this text to Administrators, Editors, Authors, and Contributors:
Display this text to Administrators, Editors, Authors, Contributors, and Subscribers:
Text only for specific roles
If you want to show a note only to a certain role, you have to use a
In this way, for example, an Administrator or an Editor (roles higher than Author) cannot read a note for Authors only.
These are all the cases:
Display this text to Editors only:
Display this text to Authors only:
Display this text to Contributors only:
Display this text to Subscribers only:
Display this text to Visitors only:
Text for Visitors only
Text only for a specific user or multiple users
In the case you want to show a text only to a specific user, assign
role and a login name to
login-name with the correct login name of the target user.
You can use a comma separated list of usernames to target certain users:
login-name3 with the correct login names of the target users.
Text NOT for some users
If you want to show a text to all users but not to some, activate the option
reverse, so that users added in the
recipient option will not read the note.
We all read this message while Alice, Bob, and Charlie can't read it!
Alternate text for non-targeted users
If you want to show an alternate text in case the reader can’t read, you can use:
You have not rights to read this.
Please, take note that the alternate text, if defined, is always publicly displayed.
The alternate text can contain some HTML tags. The list is:
strongfor bold text;
ifor italic text;
afor links, with
titledo not use double quote, but single quote.
Container for the text
Starting from version 2.4, the user can choose the container element for the text:
pis the default value;
divis another option. This element allows you use HTML elements like lists, headings, and more.
spanis the final option. This element allows you to add private content inline.
Wrap the note inside a DIV:
Wrap the note inside a SPAN:
I met with a friend for lunch.
Standard WordPress user roles
WordPress roles in descending order:
Capabilities created by Private Content plugin
These are the capabilities created by this plugin:
This plugin does not collect any user data.
Many thanks to: