I know in MySQL exists a query like this:
SELECT * FROM mytable WHERE id IN (1,2,3,4) ORDER BY FIELD(id,3,2,1,4);
Is there a way to accomplish the same in WP_Query? I want to order especifically the meta_value like this: 0, 2, 1, 3, 4
Here are my args:
$args_com_subset = array(
'posts_per_page' => -1,
'post_type' => 'company',
'meta_key' => 'company_tiers',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'company_type',
'value' => 'full_methodology_n_subset_of_indicators',
'compare' => '='
),
array(
'key' => 'company_type',
'value' => 'subset_of_indicators',
'compare' => '='
)
),
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'company_year',
'field' => 'slug',
'terms' => '2020'
)
)
);