Make WordPress Core

Opened 9 years ago

Last modified 5 years ago

#30530 new enhancement

Enhance privacy by hiding posts of other users

Reported by: minderdl's profile minderdl Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords: reporter-feedback
Focuses: administration Cc:


I haven't found an entry in Trac for this, but I know that this is discussed in blogs/stackexchage/... many times: A feature to hide posts of other authors in the admin interface.

The proposed solutions mostly include a pre_get_posts or request filter. However, most comments critizise that the post counter is still wrong. Thus, another filter for wp_count_posts is needed, duplicating much of the code of wp-includes/post.php's wp_count_posts(). Moreover, the select query in the original wp_count_posts() is executed anyway, but the result is thrown away. Finally, to make caching work, a third filter for transition_post_status to clear the post counter cache is needed.

An all this just to hide the posts of other users...

There should be an easy option to achieve this provided by the Core. There could be a 'list_others_*' capability that is honoured by query.php's get_posts() and post.php's wp_count_posts(). One could argue that published posts could be seen anyway, so the capability could also be named 'list_others_protected_*' and hides/shows the posts with a post_status marked as protected (get_posts() includes all posts with these status if we are in the admin).

That would be a great feature often requested by users and greatly enhancing the CMS capabilities!

Change History (3)

#1 @boonebgorges
9 years ago

  • Component changed from Posts, Post Types to Query

This ticket was mentioned in Slack in #core by boone. View the logs.

8 years ago

#3 @boonebgorges
8 years ago

  • Focuses administration added
  • Keywords reporter-feedback added

@minderdl Sorry for the delay in responding to this ticket.

A pre_get_posts filter is, as you note, sufficient to make this work from the point of view of the main query itself.

There is already a 'Mine' filter on wp-admin/edit.php. When you say that you'd like a feature that shows only the posts of the logged-in user, how would it differ from this? What would the feature be like? Would it be something toggleable in the interface, or would a developer enable it somehow? How?

Note: See TracTickets for help on using tickets.