WC_Data_Store_WP::delete_from_lookup_table()publicWC 3.6.0

Delete lookup table data for an ID.

Method of the class: WC_Data_Store_WP{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Data_Store_WP = new WC_Data_Store_WP();
$WC_Data_Store_WP->delete_from_lookup_table( $id, $table );
$id(int) (required)
ID of object to update.
$table(string) (required)
Lookup table name.

Changelog

Since 3.6.0 Introduced.

WC_Data_Store_WP::delete_from_lookup_table() code WC 9.4.2

public function delete_from_lookup_table( $id, $table ) {
	global $wpdb;

	$id    = absint( $id );
	$table = sanitize_key( $table );

	if ( empty( $id ) || empty( $table ) ) {
		return false;
	}

	$pk = $this->get_primary_key_for_lookup_table( $table );

	$wpdb->delete(
		$wpdb->$table,
		array(
			$pk => $id,
		)
	);
	wp_cache_delete( 'lookup_table', 'object_' . $id );
}