[wp-trac] [WordPress Trac] #38034: post__in orderby not working when passed in an array to orderby
WordPress Trac
noreply at wordpress.org
Fri Feb 3 03:48:00 UTC 2017
#38034: post__in orderby not working when passed in an array to orderby
-------------------------------+------------------------------
Reporter: kelvink | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 4.6
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by maccast):
Not sure if this has gotten worse or if I'm experiencing a different
issue, but I have a site where the `post__in` sort order is not working
anymore when it was in the past. For me it's doesn't work even if i use a
string or an array. It was working in the past and I only noticed the
issue after upgrading to Wordpress 4.7.2.
Here is my code for reference:
{{{
$query_images_args = array( 'post__in' => explode(',',$include),
'post_parent' => $thePost->ID, 'post_type' => 'attachment',
'post_mime_type' =>'image', 'post_status' => 'inherit', 'orderby' =>
'post__in' );
$featuredPosts = new WP_Query( $query_images_args );
}}}
Another possible difference is I'm getting the gallery attachments
associated with the post, but my `$include` contains the a comma
seperatedstring of the gallery image_ids in the order I want them sorted
in.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38034#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list