WP DB Element

Allows you to manipulate the WP database by inserting, deleting, selecting, etc.

When to use?

Whenever you need data from the database that could not reasonably be obtained through WP Queries, or perhaps if you have an advanced idea for which you need the database.

How to use:

  1. First, choose an Action from the dropdown list.
    • You might notice that Select and Query both give you a custom field into which to enter a query. What's the difference?
    • Select uses get_results(), while Query uses the generic query() method.
  2. If you chose Insert, Update, Delete, or Replace, you will need to fill out key -> value pairs that correspond to the columns in the table you're modifying.
  3. In addition, you will be able to enter a format string. To do this, for each value, enter the corresponding format you wish to use.
  4. Enter a name and pick a scope type under which to store the last_result. This is the result from the last query you've run. Make sure to store it with e.g. Set Parameter Element if you wish to keep it later on, because subsequent queries will overwrite this result.
  5. If you are inserting data into the database, enter a name and pick a scope type for the insert_id that is automatically generated when you insert. As stated before, if you need this data, make sure to store it so it doesn't get overwritten.