[wp-trac] [WordPress Trac] #12755: Detached media sorted in reverse by date
WordPress Trac
wp-trac at lists.automattic.com
Mon Mar 29 07:05:32 UTC 2010
#12755: Detached media sorted in reverse by date
----------------------------+-----------------------------------------------
Reporter: sbressler | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: Administration | Version: 3.0
Severity: normal | Keywords: media, ordering, sorting
----------------------------+-----------------------------------------------
Comment(by nacin):
Depending on the situation, it's one of these queries:
{{{
// when searching for orphaned attachments (had a parent).
$orphans = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts
WHERE post_type = 'attachment' AND ID IN (%s) LIMIT %d, %d", $lost,
$start, $media_per_page ) );
// when searching for attachments without a parent (and never had one).
$orphans = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS
* FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status !=
'trash' AND post_parent < 1 LIMIT %d, %d", $start, $media_per_page ) );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12755#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list