Appearance
Post Query
The Post Query node fetches WordPress posts, pages, or custom post types using WP_Query. Use it when your data is stored as WordPress posts rather than custom database tables.
Configuration
| Property | Type | Default | Description |
|---|---|---|---|
postType | string | post | The post type slug (e.g., post, page, product, or a WP-Nexus CPT like nxs_mytype). |
status | string | publish | Post status filter: publish, draft, pending, private, any. |
orderBy | string | date | Field to sort by: title, date, ID, modified, rand, name, author, or any meta key. |
order | string | DESC | Sort direction: ASC or DESC. |
conditions | array | [] | Array of condition objects. Each has field, op, value, and optionally value2 (for BETWEEN). See Table Query: Conditions for full details. |
conditionLogic | string | AND | How multiple conditions combine: AND or OR. |
limit | number | 100 | Maximum posts to return (capped at 1,000). |
offset | number | 0 | Number of posts to skip. |
Input
This is a source node -- it has no input port.
Output
Returns an array of post objects with both core fields and all post meta flattened into each row:
json
[
{
"ID": 42,
"post_title": "Hello World",
"post_content": "<p>Welcome to my site.</p>",
"post_excerpt": "",
"post_status": "publish",
"post_date": "2025-03-15 09:00:00",
"post_author": "1",
"featured_image": "https://example.com/image.jpg",
"custom_field": "some value"
}
]How It Works
The node builds a WP_Query arguments array and executes the query. For each returned post, it:
- Extracts core post fields (
ID,post_title,post_content,post_excerpt,post_status,post_date,post_author). - Fetches all post meta via
get_post_meta()and merges it into the row at the top level.
Order By Meta Keys
When orderBy is set to a value that does not match a core field (e.g., price, rating), the node automatically sets meta_key and uses meta_value ordering. For known numeric field names (price, count, quantity, amount, rating, order), it uses meta_value_num for correct numeric sorting.
TIP
This node supports the enhanced conditions system with multiple conditions, AND/OR logic, and operators like BETWEEN, IN, NOT IN, IS NULL, and IS NOT NULL. See the Table Query: Conditions documentation for full details. Legacy single-condition properties (whereField, whereOp, whereValue) still work for backward compatibility.
WHERE Filtering
Filtering behavior depends on the field type:
post_titlewithLIKE: Uses thes(search) parameter ofWP_Query.post_author: Filters by author ID.post_status: Overrides thestatusconfig.- Any other field: Creates a
meta_querywith the specified comparison operator.
Example Use Cases
List published blog posts
postType: "post"
status: "publish"
orderBy: "date"
order: "DESC"
limit: 10Filter products by price range
postType: "product"
status: "publish"
whereField: "price"
whereOp: ">="
whereValue: "50"
orderBy: "price"
order: "ASC"Search posts by title
postType: "post"
whereField: "post_title"
whereOp: "LIKE"
whereValue: "tutorial"TIP
If your data does not need WordPress post features (revisions, taxonomies, featured images), consider using a custom database table instead. Custom tables are faster and produce simpler row structures.