Build correct WordPress queries in seconds — without memorizing parameters or digging through the Codex.

  • Save time — stop writing query arrays from scratch
  • Avoid mistakes — every field includes a short explanation of what it does
  • Copy & paste ready — get clean PHP or JSON you can drop into your theme or plugin
  • All major query classes — WP_Query, User, Comment, Term, Tax, Meta, Date, Network & Site

WP_Query

Posts, Pages, Products, Custom Post Types

General Settings

Core parameters that control what posts are returned and how they are ordered.

Name of the PHP variable that will hold the query object. Example: $products_query

Comma-separated list of post types. Use "any" for all types. Examples: post, page, product, download

publish (default), draft, private, pending, future, trash, any

How many posts to show. Use -1 to show all posts (be careful on large sites).

Number of posts to skip. Useful for custom pagination or "load more".

Which page of results to show. Usually used with pagination.

How to sort the results. "meta_value" requires meta_key to be set.

Direction of sorting.

Performs a search against post title and content (same as the WordPress search).

When checked, sticky posts are treated like normal posts and do not appear first.

Disables pagination and returns all matching posts. Prefer posts_per_page = -1 in most cases.

Adds a ready-to-use while(have_posts()) loop in the generated code.

Author

Filter posts by the user who created them.

Numeric user ID. Faster than using the nicename.

The user_nicename (usually the same as the username). Example: john-doe

Specific Post / Page

Target one or more exact posts or pages.

Single post ID. Returns only that post.

The post_name (URL slug). Example: my-awesome-post

Same as Post ID but specifically for pages.

Can include parent path. Example: about/team

Return only children of this parent. Useful for hierarchical post types.

Taxonomy (Simple)

Quick category and tag filters. For complex multi-taxonomy logic use the Tax Query generator.

Comma-separated category IDs. Example: 5,12,18

Category slug. Use comma for multiple (acts as OR).

Tag slug or comma-separated list of tag slugs.

Custom Field (Simple)

Basic meta query. For multiple conditions or complex compares use the Meta Query generator.

The custom field name (e.g. _price, event_date, featured).

The value to match against the meta key.

How to compare the meta value.

Generated Code

// Fill the form and click "Generate Code"
{}

WordPress Query Generator is a free query builder and query tool that helps you create custom WordPress queries in seconds. Generate clean, ready-to-use code for WP_Query, User Query, Comment Query, Term Query, Tax Query, Meta Query, Date Query, and more — without writing complex arrays from scratch.

This easy-to-use Query generator for WordPress features a clean frontend interface, detailed field guidance, AJAX navigation, and instant PHP/JSON output. Perfect as your daily query script for building post loops, filtering products, listing users, or creating advanced taxonomy and meta queries faster and with fewer mistakes.