Apparently attachments now default to a ‘post_status’ of ‘inherit’
Fixed by changing line 358 to:
$where = str_replace(" AND (post_status = 'publish'", " AND (post_status = 'publish' OR post_status = 'attachment' OR wp_posts.post_status = 'inherit'", $where);
And line 363 to:
$where = str_replace(" AND ($wpdb->posts.post_status = 'publish'", " AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'attachment' OR $wpdb->posts.post_status = 'inherit'", $where);
thanks for this. super helpful!
I also found this issue, my change was similar but I swapped the search criteria of post_status = ‘attachment’ with post_type = ‘attachment’
I tried amending the lines 397 and following as follows, but it still does not work I am afraid:
$where = str_replace(" AND (post_status = 'publish'", " AND (post_status = 'publish' OR post_type = 'attachment' OR post_status = 'inherit'", $where);
$where = str_replace("AND post_type != 'attachment'","",$where);
}
else
{
$where = str_replace(" AND ($wpdb->posts.post_status = 'publish'", " AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_type = 'attachment' OR $wpdb->posts.post_status = 'inherit'", $where);
Any leads appreciated.
Thanks!