Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

tax-query

Multiple terms not working on taxonomy

Try changing the field value to term_id, since there is no id value for that option. Ref: WP_Query Taxonomy Parameters

Categories query Tags query, tax-query, terms

How to get hierarchical number of custom taxanomy

You can use get_ancestors() to get an array of parents, which you can then count. $term_id = 42; $ancestors = get_ancestors( $term_id, ‘category’ ); if( ! empty( $ancestors ) ){ echo count( $ancestors ); }

Categories wp-query Tags custom-taxonomy, tax-query, wp-query

Escaping WP_Query tax_query when term has special character(s)

I’m not sure if this is a bug, but it need further investigation. I’ve run a few quick tests on the name field in a tax_query, and whenever a term name has got a special character or have more than one word, the tax_query is excluded from the SQL query TEST 1 I have use … Read more

Categories wp-query Tags escaping, sanitization, tax-query, wp-query

Multiple tax_queries: display posts titles from several custom taxonomie

Multiple tax_queries: display posts titles from several custom taxonomie

Categories wp-query Tags tax-query, wp-query

WP_Query: Meta_Query with serialized value (or a workaround)

WP_Query: Meta_Query with serialized value (or a workaround)

Categories wp-query Tags array, tax-query, wp-query

Custom query for tag and custom tag from 2 post type

Custom query for tag and custom tag from 2 post type

Categories wp-query Tags custom-taxonomy, query, tax-query, wp-query

Empty ‘terms’ in ‘tax_query’ returns an empty array

Empty ‘terms’ in ‘tax_query’ returns an empty array

Categories wp-query Tags tax-query, taxonomy, wp-query

Extending WP Query: Custom geolocation meta values work, but tax_query breaks

I’ve discovered a solution. I don’t know if it’s the best solution, but it does work. GROUP BY wp_posts.ID was causing my query to error out. I don’t quite understand why. In theory, my query should be returning duplicate posts without it… but it’s not. So, I’m going to push this code live as it … Read more

Categories wp-query Tags geo-data, meta-query, tax-query, wp-query

Escaping WP_Query tax_query when term has special character(s)

I’m not sure if this is a bug, but it need further investigation. I’ve run a few quick tests on the name field in a tax_query, and whenever a term name has got a special character or have more than one word, the tax_query is excluded from the SQL query TEST 1 I have use … Read more

Categories wp-query Tags escaping, sanitization, tax-query, wp-query

Query breaking with ‘posts_per_page’ => -1

Query breaking with ‘posts_per_page’ => -1

Categories custom-post-types Tags custom-post-types, tax-query, wp-query
Older posts
Newer posts
← Previous Page1 … Page3 Page4 Page5 … Page29 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress