Sort by presence of thumbnail
Easy peasy! $args_for_query1 = [ ‘post_type’ => ‘custom_project’, ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘_thumbnail_id’ ) ) ]; $args_for_query2 = [ ‘post_type’ => ‘custom_project’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘_thumbnail_id’, ‘meta_compare’ => ‘NOT EXISTS’, ]; $query1 = new WP_Query($args_for_query1); $query2 = new WP_Query($args_for_query2); $wp_query = new WP_Query(); $wp_query->posts = array_merge( $query1->posts, $query2->posts … Read more