I have this code:
$args = array(
'posts_per_page' => -1,
'post_type' => 'product',
'meta_key' => 'custom key',
'orderby' => 'meta_value',
'order' => 'ASC',
'no_found_rows' => true,
'cache_results' => false,
'include_children' => false,
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'id',
'terms' => array($cat_id)
)
)
);
$loop = new WP_Query($args);
When the custom key is like
FA3
FA1
FA10
the wp query orderby paramaters sorts this as
FA1
FA10
FA3
when I want a nsort-algoritm:
FA1
FA3
FA10
Is there any way of acheiving this with WP_Query
? (Or is the only option to create an array and sort that array with nsort()
)