[wp-trac] [WordPress Trac] #29169: Scan for lost attachments: $lost is lost
WordPress Trac
noreply at wordpress.org
Tue Aug 12 00:29:31 UTC 2014
#29169: Scan for lost attachments: $lost is lost
--------------------------+------------------
Reporter: afercia | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.0
Component: Media | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------
Comment (by afercia):
hi Sergey, thx very much.
For me, it doesn't work. It gets the query arg and that's ok but then
`wp_edit_attachments_query()` returns 0 posts because `$q['detached']` is
still set.
[[Image(http://i.imgur.com/wtx9bXz.png)]]
When detached is set, `wp_edit_attachments_query()` sets 'post_parent' to
0 so it excludes my lost attachment which has a post_parent > 0.
If I'm not wrong, scan for lost attachment was intended for media attached
to no longer existing posts but with (for any reasons) post_parent > 0
which is different from "Unattached" media that normally have post_parent
= 0.
Adding to your patch `unset( $q['detached'] );` together with
`$q['post__in']`, then it works but I'm not 100% sure, there may be better
ways.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29169#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list