Skip to content

Save Row

The Save Row node inserts new rows into a WP-Nexus database table, custom post type, or taxonomy. It is the primary node for creating new records from form submissions or pipeline-generated data.

Configuration

PropertyTypeDefaultDescription
tableIdnumber--Required. The ID of the WP-Nexus table to insert into.

Input

Accepts a single object or an array of rows. Each object's keys should match the table's column names.

Output

Returns the same rows with the newly generated ID added:

  • Custom tables: id field is added (auto-increment value).
  • Custom post types: ID field is added (WordPress post ID).
  • Taxonomies: term_id field is added.

On error, an _error field is added to the row.

How It Works

The behavior depends on the table's storage type:

Custom Table

  1. Removes the id field from the input (auto-increment handles it).
  2. Inserts the row via $wpdb->insert().
  3. Adds the insert_id as id on the returned row.

Custom Post Type

  1. Extracts core fields: post_title, post_content, post_status.
  2. Calls wp_insert_post() with sanitized values.
  3. Saves custom fields as post meta (prefixed with nxs_).
  4. Adds the ID to the returned row.

Taxonomy

  1. Extracts name (required), slug, and description.
  2. Calls wp_insert_term().
  3. Saves custom fields as term meta (prefixed with nxs_).
  4. Adds the term_id to the returned row.

Example Use Cases

Save a contact form submission

Context --> Validate --> Sanitize --> Save Row (tableId: 3) --> Send Email --> Output

Insert with computed fields

Context --> Set Field (created_at = now()) --> Set Field (status = 'pending') --> Save Row --> Output

Batch insert

Connect an array of rows to save multiple records:

Static Data --> Save Row (tableId: 5) --> Output

WARNING

Save Row is a write node -- it modifies the database on every execution. Always protect it with Validate and Sanitize in user-facing pipelines. Add Require Auth if only logged-in users should be able to create records.

TIP

The id field in the input is automatically removed before insertion, so you can safely pass form data that includes an id field without causing conflicts.