args for sorting taxo AND Meta-Num-Field – $query = new WP_Query($args);

[ad_1]

I searched the net, I asked chatgpt…. Nothing! Everything does not work…

​

I want to display my posts of the post type “book”. The books have a taxonomy called “series”. The “series” has the field “name”. And each post has a volume number.

​

I would like to display them sorted as follows:

SERIES A (taxonomy -> name)

\- Volume 1 (volume number)

\- Volume 2

… Volume x

SERIES B

\- Volume 1

… Volume x

​

I can plot and sort a single series, but I can’t get the args to sort all the post books that way.

​

So far I am filtering my posts like this – it works.

$args = array(

‘post\_type’ => ‘book’,

‘tax\_query’ => array(

array(

‘taxonomy’ => ‘book\_series’,

‘field’ => ‘name’,

‘terms’ => $book\_series,

),

),

// it will be sorted by BAND-NR 1 … x

‘meta\_key’ => ‘book\_band’,

‘orderby’ => ‘meta\_value\_num’,

‘order’ => ‘ASC’,

);

​

But I don’t want to filter, I want to list quasi all books as described above. Anyone have any idea what the args for $query = new WP\_Query($args); might look like?

Am grateful for any help.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer