I have an array of IDs and I want to get that posts by WP_Quey()
$myarray = $ids;
$args = array( 'post__in' => $myarray);
// The Query
$the_query = new WP_Query( $args );
Its, Sort result by date But I want to sort it by $myarray items and first result would be first ID in $myarray
In Wordpress 3.5 and up you can use 'orderby'=>'post__in'
then you must write this:
$myarray = $ids;
$args = array('post__in'=> $myarray, 'orderby'=>'post__in');
// The Query
$the_query = new WP_Query( $args );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With