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