Tag 302/2016: Let subscribers read private pages in WordPress

This is about content visibility in WordPress: „Private Pages“ can only be read by logged in users with the Editor or Administrator role.

You might want to give Subscribers permission to read Private Pages.

This can be achieved by adding the capability „read_private_pages“ to the Subscriber role. If you search online you’ll find lots of examples where this setting is done in a themes functions.php. I’m not happy with that approach: Writing to the database on every request for a one time setting is unnecessary overhead.

So just do it once: Use for example the wp-cli tool and run this command on your server:

wp-cli --path=/path/to/your/project cap add subscriber read_private_pages

If you want to see the current capabilities, use „list“:

wp-cli --path=/path/to/your/project cap list subscriber

Piece of cake.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Falls du auf diesen Beitrag mit einem Artikel auf deiner eigenen Webseite geantwortet hast, kannst du hier die URL deines Beitrags eingeben. Dabei sollte es sich um die Permalink-URL handeln. Deine Antwort wird dann (möglicherweise nach der Moderation) auf dieser Seite angezeigt. Falls du deine Antwort aktualisieren oder entfernen möchtest, aktualisiere oder lösche deinen Beitrag auf deiner eigenen Webseite und gib die URL des Beitrags erneut ein. (Erfahre mehr über Webmentions.)