Appearance
Table Query
The Table Query node fetches rows from a WP-Nexus custom database table. It is the most common source node for apps that use custom tables.
Configuration
| Property | Type | Default | Description |
|---|---|---|---|
tableId | number | -- | Required. The ID of the WP-Nexus database table to query. |
orderBy | string | id | Column name to sort by. |
order | string | DESC | Sort direction: ASC or DESC. |
conditions | array | [] | Array of condition objects (see Conditions below). |
conditionLogic | string | AND | How multiple conditions combine: AND (all must match) or OR (any must match). |
limit | number | 100 | Maximum number of rows to return (capped at 1,000). |
offset | number | 0 | Number of rows to skip before returning results. |
Legacy single-condition properties
These flat properties still work for backward compatibility. If conditions is present, it takes precedence.
| Property | Type | Default | Description |
|---|---|---|---|
whereField | string | -- | Column name to filter on. |
whereOp | string | = | Comparison operator. |
whereValue | string | -- | Value to compare against. |
Input
This is a source node -- it has no input port. It always produces data from scratch.
Output
Returns an array of row objects. Each row is an associative array with column names as keys.
json
[
{ "id": 1, "title": "First item", "status": "active", "created_at": "2025-03-01 10:00:00" },
{ "id": 2, "title": "Second item", "status": "draft", "created_at": "2025-03-02 14:30:00" }
]How It Works
For custom tables (the default storage type), the node builds a native SQL query with WHERE, ORDER BY, LIMIT, and OFFSET clauses. This means filtering and sorting happen at the database level for optimal performance.
For tables backed by Custom Post Types or Taxonomies, the node uses WP_Query or get_terms() respectively, then applies query options in PHP as a fallback.
Conditions
The Table Query node supports multiple WHERE conditions with AND/OR logic. In the UI, each condition is a row with a field name, operator, and value. Click Add condition to add more rows, or the remove button to delete one.
AND / OR toggle
When you have two or more conditions, an AND/OR toggle appears. Choose AND to require all conditions to match, or OR to match rows where any condition is true. The default is AND.
Field autocomplete
The field name input suggests column names from the selected table's schema. When you pick a table, its columns are fetched automatically and offered as autocomplete suggestions. You can also type any field name manually -- the input accepts free text.
Operators
| Operator | Description | Example SQL |
|---|---|---|
= | Equal | WHERE status = 'active' |
!= | Not equal | WHERE status != 'draft' |
> | Greater than | WHERE price > 100 |
< | Less than | WHERE price < 50 |
>= | Greater than or equal | WHERE price >= 10 |
<= | Less than or equal | WHERE price <= 99 |
LIKE | Partial match (wraps value in %) | WHERE title LIKE '%search%' |
BETWEEN | Between two values (inclusive) | WHERE price BETWEEN 10 AND 50 |
IN | Matches any value in a list | WHERE status IN ('active', 'pending') |
NOT IN | Does not match any value in a list | WHERE status NOT IN ('draft', 'trash') |
IS NULL | Value is null | WHERE deleted_at IS NULL |
IS NOT NULL | Value is not null | WHERE email IS NOT NULL |
Operator-specific inputs
- BETWEEN: Shows two value fields. Enter the lower bound in the first and the upper bound in the second.
- IN / NOT IN: Enter values as a comma-separated list (e.g.,
active, pending, review). Each value is individually escaped. - IS NULL / IS NOT NULL: No value field is shown -- these operators test for the presence or absence of a value.
All values are escaped using $wpdb->prepare() to prevent SQL injection.
Dynamic Config with Expressions
Condition values support { { }} expressions. This lets you build dynamic queries based on upstream data:
conditions:
- field: "user_id"
op: "="
value: "{{ input.id }}"Example Use Cases
Basic: List all active products
tableId: 3
conditions:
- field: "status"
op: "="
value: "active"
conditionLogic: "AND"
orderBy: "created_at"
order: "DESC"
limit: 50Multiple conditions with AND logic
tableId: 3
conditions:
- field: "status"
op: "="
value: "active"
- field: "price"
op: "BETWEEN"
value: "10"
value2: "100"
conditionLogic: "AND"
orderBy: "price"
order: "ASC"Multiple conditions with OR logic
tableId: 3
conditions:
- field: "category"
op: "="
value: "electronics"
- field: "category"
op: "="
value: "accessories"
conditionLogic: "OR"IN operator with comma-separated values
tableId: 3
conditions:
- field: "status"
op: "IN"
value: "active, pending, review"IS NULL to find missing data
tableId: 3
conditions:
- field: "deleted_at"
op: "IS NULL"Paginated listing
tableId: 3
orderBy: "title"
order: "ASC"
limit: 10
offset: 20Dynamic: Show orders for a specific user
Connect a Current User node upstream, then use its output in the config:
tableId: 5
conditions:
- field: "user_id"
op: "="
value: "{{ input.id }}"
orderBy: "created_at"
order: "DESC"TIP
For the best performance, add database indexes to columns you frequently filter or sort on. You can configure indexes in the WP-Nexus table editor.