• I use that code to sort posts in archives by date from Advanced Custom Fields. For example, this code sorts posts from my custom taxonomy “genre”:

    function ptc_customize_wp_query( $query ) {
    if ( $query->is_tax( 'genre', ) ) {
    // Sort posts by project start date.
    $query->set( 'order', 'DESC' );
    $query->set( 'orderby', 'meta_value_num' );
    // ACF date field value is stored like 20220328 (YYYYMMDD).
    $query->set( 'meta_key', 'release-date' );
    }
    }

    But when I try to add additional taxonomies, they just do not work, works only the first one.

    if ( $query->is_tax( 'genre', 'publisher', 'developer' ) ) {

    The code above doesn’t work for ‘publisher’ and ‘developer’ taxonomies. But I want that it to work with multiple taxonomies. How to achieve this?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_tax doesn’t work with multiple taxonomies, How to fix?’ is closed to new replies.