WP_Query Builder

Configure your WordPress query visually: post type, taxonomy filters, ACF fields and ordering. The tool generates the complete PHP block with wp_reset_postdata() ready to paste.

Tipo e stato
post_type
Premi Enter o virgola per aggiungere. Lascia vuoto per 'post'.
post_status
Paginazione
posts_per_page
-1 = tutti
paged
offset
no_found_rows
Ordinamento
orderby
order
Post specifici
post__in
ID da includere (preserva l'ordine con orderby=post__in)
post__not_in
ID da escludere
post_parent
Autore
author
author_name
author__not_in
Data
year
monthnum
day
Oppure usa date_query avanzata:
after
before
column
Taxonomy query
Meta query (campi ACF)
relation
Opzioni extra
ignore_sticky_posts
suppress_filters - disabilita filtri plugin
fields
cache_results
update_post_meta_cache
update_post_term_cache

WP_Query is the primary class for querying the WordPress database: it retrieves posts, pages and custom post types with complex filters on taxonomy, ACF meta fields, date, author, status and more. Mastering its syntax takes practice, and a wrong parameter can cause infinite loops or unexpected results.

This visual builder generates:

  • post_type, posts_per_page, paged, offset
  • Tax queries for categories, tags and custom taxonomies (AND/OR, IN/NOT IN)
  • Meta queries for ACF fields with comparison operators (=, !=, >, <, LIKE)
  • Ordering parameters including meta_value and meta_value_num
  • Complete PHP snippet with comments and wp_reset_postdata()

WP_Query - quick reference

The most useful parameters explained for custom themes and ACF workflows.

Performance tips

  • For queries without pagination, set no_found_rows => true: WordPress skips total row count and avoids an extra SQL query.
  • If you only need post IDs, use fields => 'ids': this avoids loading full WP_Post objects.
  • For very frequent queries, consider update_post_meta_cache => false when meta values are not used in the loop.

Main parameters

  • post_type: string or array. Use 'any' for any type, 'attachment' for media.
  • posts_per_page: -1 returns all posts, but watch performance on large databases.
  • meta_query: array of clauses for ACF/custom fields. Each clause usually includes key, value and compare.
  • tax_query: filters by taxonomies (category, post_tag, custom taxonomies) with AND/OR relation support.
  • orderby + order: sort by date, title, meta value, menu order, random, and more.