Pass array of taxonomy terms to wp_query

The problem is ambiguity, you can’t just put in ‘relation’ => ‘OR’ in the main parameter list, because how would WP_Query know if it’s for the tax_query and not the meta_query? For how it’s supposed to work, and where the relation parameter goes we need to refer to the official docs for WP_Query which gives … Read more

How to make a custom taxonomy selectable in post publish area?

The reason it does not show up automatically is because it requires REST enabled to display. By default, show_in_rest is set to false when registering taxonomies and post types. There’s currently a Trac Ticket #42785 open to change this default functionality. So in short when registering a taxonomy while using the Block Editor you’ll need … Read more

tax_query returning all posts instead of selective posts in WP_Query

Taxonomy Parameters Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays). This construct allows you to query multiple taxonomies by using the relation parameter in the first (outer) array to describe the boolean relationship between the taxonomy arrays. In ‘tax_query’ you should add array of arrays (see … Read more

Exclude custom taxonomy tag from loop

I have rewritten the query_posts. As for get_posts you are better off using the WP_Query due to more control over the tax_query. Explained here. <?php $args = array( ‘cat’ => 84, ‘posts_per_page’ => 3, ‘offset’ => 0, ‘tax_query’ => array( ‘relation’ => ‘NOT IN’, array( ‘taxonomy’ => ‘display’, ‘field’ => ‘slug’, ‘terms’ => ‘featured-slider’ ) … Read more

Show only, when taxonomy has posts?

If you take a look at the array that get_the_terms() returns, you’ll see that it includes a “count”. If I understand your question correctly, you’re looking to find all posts with a count greater than 1 (i.e. terms that are on more than the current post). So, I think you can simply change your foreach … Read more

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