Complex WP_Query (two post types and multiple operators)

Ok, according to the codex, if you use tax_query in your arguments for WP_Query, then it will change the default of post_type from posts to any, BUT if a post_type has exclude_from_search set to true then it still won’t include it in any. So since we don’t know what the configuration is on the portfolio post_type, I suggest you explicitly instruct the query to search for both posts and your portfolio_post_type.

$args = array(
    //you'll need to put in the correct post-type for your portfolio items.
    //the codex says that if you use 'tax_query' that post_type should default to 'any'
    //but for the sake of it, try this...
    'post_type' => array( 'posts, portfolio_post_type' ),
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'orderby' => 'date',
    'tax_query' => array(
        'relation' => 'OR',
        array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'category',
                'field'    => 'term_id',
                'terms'    => array( 16 ),
                'operator' => 'IN'
            ),
            array(
                'taxonomy' => 'category',
                'field'    => 'term_id',
                'terms'    => array( 19 ),
                'operator' => 'NOT IN'
            ),
        ),
        array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'portfolio_category',
                'field'    => 'term_id',
                'terms'    => array( 32 ),
                'operator' => 'IN'
            ),
            array(
                'taxonomy' => 'portfolio_category',
                'field'    => 'term_id',
                'terms'    => array( 34 ),
                'operator' => 'NOT IN'
            ),
        ),
    ),
);

Here’s the codex section that discusses this: https://developer.wordpress.org/reference/classes/wp_query/#post-type-parameters

Sincerely hope this helps.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)