1. Home
  2. Docs
  3. Function Reference
  4. Functions
  5. general_insert()

general_insert()

Insert new data into a database. Close to $wpdb->insert but you don’t have to handle formats, and it will bind your table so any fields not existing in your table will be filtered.

Copy to Clipboard

Parameters

$table

Target table, escaped in the function

$data

Data to save to database, escaped in the function

$can_echo_query

If true the query will be echoed out (default false)

$can_prefix

If true, prefixes table names with the WordPress table prefix (default true)

Return

mixed

Returns inserted ID, if failed, false will be returned.

Example

Copy to Clipboard
Tags