How to Prevent Users from Reading All Pages or Posts

The PublishPress Permissions plugin is able to prevent users from reading all the posts in a specific content type.

This screenshot below shows some of the key PublishPress Permissions controls which are “Enable”, “Block”, and “Limit to”.

The best approach for blocking all posts in a content type is to choose “Limit to” and then “None” under “Select Posts”.

Block Users from Seeing All Pages/ Posts

Why not have a “Block All” button? #

A few users have asked us about setting “Limit to” and “None”. They wonder if would be simper to choose “Block” and then “All”.

The answer to this lies in WordPress and SQL work. The “Enable”, “Block”, and “Limit to” operations mirror the database query's WHERE clause:

  • “Block” appends a restrictive “AND ID NOT equal to” with a list of blocked post IDs.
  • “Enable” appends an expansive “OR ID equal to” with a list of enabled post IDs.
  • “Limit To” appends a limiting “AND ID equal to” with a list of enabled post IDs.
Adjustment on PublishPress Permissions

Although from the user's perspective, it makes sense to “Block All” posts, it is not actually implemented because of two reasons:

  1. The list of post IDs to block would be continually growing.
  2. It would be inefficient to append a list of all post IDs into the database query.

For these reasons, we don't use the Block All” approach because it would make the database bloated. So instead, we recommend using the “Limit to” option.