WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 20 months ago

#30530 new enhancement

Enhance privacy by hiding posts of other users

Reported by: minderdl Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Query Keywords: reporter-feedback
Focuses: administration Cc:

Description

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
3 years ago

  • Component changed from Posts, Post Types to Query

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


20 months ago

#3 @boonebgorges
20 months 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.