Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.


Create the item in the database

Return Return

(int|false) Record ID on success, false on error or when there's nothing to save.

Top ↑

Source Source

File: includes/abstracts/

	private function create() {

		if ( ! $this->data ) {
			return false;

		global $wpdb;
		$format = array_map( array( $this, 'get_column_format' ), array_keys( $this->data ) );
		$res    = $wpdb->insert( $this->get_table(), $this->data, $format ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
		if ( 1 === $res ) {

			$this->id = $wpdb->insert_id;

			 * Fires when a new database record is created.
			 * The dynamic portion of this hook, `$this->type`, refers to the record type.
			 * @since Unknown.
			 * @param int                          $id  Record ID.
			 * @param LLMS_Abstract_Database_Store $obj Instance of the record object.
			do_action( "llms_{$this->type}_created", $this->id, $this );

			return $this->id;
		return false;


Top ↑

Changelog Changelog

Version Description
6.0.0 Removed deprecated llms__created action hook.
4.3.0 Added deprecated hook call to llms__created action to preserve backwards compatibility.
3.24.0 Unknown.
3.14.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.