wp_query custom post type by taxonomy & standard post by taxonomy

Anyone know how I can neatly combine a query to pull CPT by a custom taxonomy and also standard posts by taxonomy into same query to list all posts together on my home page?

for example:

Read More
$args = array(
    'post_type'           => array( 'artists', 'post' ),
    'post_status'         => 'publish',
    'tag_artists'         => 'home', // cpt custom taxonomy ##
    'tag'                 => 'home', // standard post type taxonomy ##
);

$query = new WP_Query( $args );

This is clearly wrong as it finds zero results..

Related posts

Leave a Reply

1 comment

  1. here is the answer:

    $args = array(
    'post_type'     => array( 'artists', 'post' ),
    'post_status'   => 'publish',
    'tax_query' => array(
        'relation' => 'OR',
        array(
            'taxonomy' => 'tag_artists',
            'field' => 'slug',
            'terms' => array( 'home' )
        ),
        array(
            'taxonomy' => 'post_tag',
            'field' => 'slug',
            'terms' => array( 'home' )
        )
    )
    );
    
    $query = new WP_Query( $args );