This plugin provides a shortcode to display a portion of a post's content only to users of a specific role.

Usage:

Display this text only to Administrators:

[private role="administrator"]Text for Administrators[/private]

Display this text only to Administrators and Editors:

[private role="editor"]Text for Editors[/private]

Display this text only to Administrators, Editors, and Authors:

[private role="author"]Text for Authors[/private]

Display this text only to Administrators, Editors, Authors, and Contributors:

[private role="contributor"]Text for Contributor[/private]

Display this text only to Administrators, Editors, Authors, Contributors, and Subscribers:

[private role="subscriber"]Text for Subscribers[/private]

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.

If you want to show a note only to a certain role, you have to use a <role>-only option. In this way, for example, an Administrator or an Editor (roles higher than Author) can't read a note only for Authors.

Here all the cases:

[private role="editor-only"]Text for Editors only[/private]
[private role="author-only"]Text for Authors only[/private]
[private role="contributor-only"]Text for Contributors only[/private]
[private role="subscriber-only"]Text for Subscribers only[/private]
[private role="visitor-only"]Text for Visitors only[/private]

WordPress roles in descending order:

  • Administrator

  • Editor

  • Author

  • Contributor

  • Subscriber

Name of the plugin: Private Content
Plugin version: 2.1
This plugin requires WordPress 3.0
Tested up to WordPress 3.5.1
Last updated: February 16, 2013 (97 days ago)
Compatibility: 100% with WordPress 3.5.1
Tags:
Rating: 5 stars

Latest changes

  • NEW: added the possibility to show a note only to Visitors (thanks to Jacki for the tip).

Download

The stable version is hosted on the official WordPress repository: Private Content and has been downloaded 1,660 times.

The development version is hosted on GitHub. Forks are welcome!

Author

Author’s name: Aldo Latino
Profile on wordpress.org: Aldo Latino

Screenshots

  1. private-content screenshot 1

    At the center of the screen, the shortcode is used in the WordPress editor. The text inside the shortcode will be displayed only to Authors and above roles.

  2. private-content screenshot 2

    The shortcode in action. On the left, the text revealed to Administrators only; on the right, the page as seen by lower roles (Editors, Authors, etc., or simply readers).

Changelog

2.1

  • NEW: added the possibility to show a note only to Visitors (thanks to Jacki for the tip).

2.0

  • NEW: now you can show a note only to user of a specific role, hiding that note to higher roles.
  • Added uninstall.php to delete the new custom capabilities.

1.2

  • Now the inline style appears only if necessary.

1.1

  • Upon request, added the possibility to align the text left, right, centered and justified.

1.0

  • First release of the plugin.

Contributors

aldolat, specialk.

Other Notes

Credits

Many thanks to:

Support

You can get support in this forum.

Donations

Say your “Thanks!” to the developer with a small donation.