WP 5.8 “Query Loop” block: where to place custom query?

Looking into render_block_core_post_template() we can see it calls build_query_vars_from_query_block() (previously named construct_wp_query_args) to setup the query arguments of WP_Query from the Query` block properties. From there I don’t see it supporting custom taxonomies for the secondary query … yet! Work-around-idea: For the Query Loop: add a search keyword for using custom taxonomies, e.g. :query-motor-electric: and … Read more

Exclude from search all custom posts which are NOT in a taxonomy term

After reading your revised question it was easier to comprehend what you are trying to do. My new solution looks like the thing you wanted to do in the first place: it just excludes all posts which are of your custom type but don’t have the “yes”-term associated with it: $custom_query = array(); $custom_query[‘post_type’] = … Read more

SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement

You can try this SQL query for the taxonomy ‘mi_neighborhoods‘ and let’s take POST_ID = 1304 SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON (tt.term_id = t.term_id) INNER JOIN wp_term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy IN (‘mi_neighborhoods’) AND tr.object_id IN (1304) ORDER BY t.name ASC; In general … Read more

wp_get_object_terms() to get a list of all the terms attached to all the posts in the current query

I think you’re on the right track because wp_get_object_terms() can take an array of IDs for its first argument, it’s just that $wp_query is not the array you want. I can’t guarantee that this is more efficient (not my area of expertise), but I believe this [partially-tested] snippet would do what you want with at … Read more

Is it possible to add custom fields to a WooCommerce attribute term? [closed]

Yes, it is possible. And there’s an easy guide here. Below is a working code you can add to the theme’s main functions.php file: // Adds a custom rule type. add_filter( ‘acf/location/rule_types’, function( $choices ){ $choices[ __(“Other”,’acf’) ][‘wc_prod_attr’] = ‘WC Product Attribute’; return $choices; } ); // Adds custom rule values. add_filter( ‘acf/location/rule_values/wc_prod_attr’, function( $choices … Read more

Assign posts to taxonomy terms instead of the taxonomy terms to posts?

I think the “Featured Post Manager” plugin will be closer to what you’re looking for: http://wordpress.org/extend/plugins/featured-post-manager/screenshots/ The language used is somewhat confusing, and it may not work for custom taxonomies (directories) or custom types (people), BUT you can probably take the code and customize it to work for those classes of things instead, as well … Read more

Using multiple taxonomies to sort Custom Posts

Part of your trouble likely stems from the fact that you’re using the legacy version of the get_terms() function. As per the docs for this function: Since 4.5.0, taxonomies should be passed via the ‘taxonomy’ argument in the $args array: $terms = get_terms( array( ‘taxonomy’ => ‘post_tag’, ‘hide_empty’ => false, ) ); Therefore, we can … Read more

How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy

After adding print_r($wp_query); to my template and examining the results, I have discovered URL formats that work. I wrote, in my question, that the following format doesn’t work — in fact, it does – if you spell your custom taxonomy name correctly. example.com/?ctxname=term1+term2 Pretty URLs with the ‘+’ and ‘,’ operators (indicating AND and OR … Read more

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