[wp-trac] [WordPress Trac] #51852: "any" value in "post_type" param in "get_posts" by default ignore attachments

WordPress Trac noreply at wordpress.org
Tue Nov 24 00:48:46 UTC 2020


#51852: "any" value in "post_type" param in "get_posts" by default ignore
attachments
------------------------------------------+------------------------------
 Reporter:  dam6pl                        |       Owner:  (none)
     Type:  defect (bug)                  |      Status:  assigned
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Query                         |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------
Changes (by peterwilsoncc):

 * keywords:   => needs-patch needs-unit-tests
 * component:  General => Query


Comment:

 @dam6pl Hello and welcome to trac.

 I've been able to reproduce this issue (or more accurately, hit it
 recently).

 I suspect the reason behind this is because there would need to be fairly
 unperformant database queries in order to correctly determine the
 attachment's inherited status based on the parent post, ie does it inherit
 from `publish` or `private`. Knowing this becomes important when
 considering the user's permissions with the `WP_Query` `perm` argument.

 This is not to rule out a fix but to let you know it's more complicated
 than it might appear at first so any fix is unlikely to have a quick
 turnaround as it's not a simple case of adding `inherit`.

 Again, welcome and thanks for logging the report.

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


More information about the wp-trac mailing list