LLMS_Abstract_Database_Store::delete()

Delete the object from the database


Return Return

(boolean) true on success, false otherwise.


Top ↑

Source Source

File: includes/abstracts/llms.abstract.database.store.php

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
public function delete() {
 
    if ( ! $this->id ) {
        return false;
    }
 
    $id = $this->id;
    global $wpdb;
    $where = array_combine( array_keys( $this->primary_key ), array( $this->id ) );
    $res   = $wpdb->delete( $this->get_table(), $where, array_values( $this->primary_key ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
    if ( $res ) {
        $this->id   = null;
        $this->data = array();
 
        /**
         * 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}_deleted", $id, $this );
 
        return true;
    }
    return false;
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Removed deprecated llms__deleted action hook.
4.3.0 Added deprecated hook call to llms__deleted 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.