[wp-trac] [WordPress Trac] #48556: Query for multiple post types not considering user permission to retrieve private posts

WordPress Trac noreply at wordpress.org
Mon Aug 24 18:13:46 UTC 2020


#48556: Query for multiple post types not considering user permission to retrieve
private posts
--------------------------+-----------------------------
 Reporter:  leogermani    |       Owner:  SergeyBiryukov
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  5.6
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------------

Comment (by boonebgorges):

 Hi @leogermani - Thanks for working on this ticket. Your description of
 the problem, and your general approach to fixing it, seem correct to me.

 > 3) I made it in a way it only changes the query in the very specific
 case of this ticket. The code could be cleaner if we changed the way the
 query is built in every case, but I thought this would bring less problems
 for developers

 This decision means that there are two places where the `post_status`
 logic is built: one for single post types, and one for multiple post types
 and/or 'any'. This will create a maintenance burden in the future. Could
 you please rework the patch so that the multiple-post-type logic is part
 of this block https://core.trac.wordpress.org/browser/tags/5.5/src/wp-
 includes/class-wp-query.php#L2514? This also means that we should have
 tests covering the existing behavior - there are some in
 tests/phpunit/tests/query/postStatus.php, but this should be reviewed for
 completeness.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48556#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list