Skip to content

Data Model Hooks

Alejandro Mostajo edited this page Oct 24, 2019 · 1 revision

Wordpress hooks related to the DataModel class.

NOTE: Replace {table} with the model's table name; following the samples in at the DataModel article, in the following samples. {table} would be replaced with model_table.


Filter: data_model_{table}_excluded_save_fields

Filters the default retuned value in protected_properties() (See documentation).

Parameter Type Description
$excluded array List of excluded properties.

Returns: array.


Action: data_model_{table}_updated

Triggered by the model's save() method (See documentation) after data is updated in the database.

Parameter Type Description
$model Model Updated model instance.

Action: data_model_{table}_inserted

Triggered by the model's save() or static::inserted() methods (See documentation) after data is saved in the database.

Parameter Type Description
$model Model Inserted model instance.

Action: data_model_{table}_save

Triggered by the model's save() method (See documentation) after data is saved in the database (inserted or updated).

Parameter Type Description
$model Model Saved model instance.

Action: data_model_{table}_deleted

Triggered by the model's delete() method (See documentation) after record is deleted from the database.

Parameter Type Description
$model Model Deleted model instance.

Filter: data_model_{table}

Triggered when the model is filled with data when sataitc::find() is called (See documentation).

Parameter Type Description
$model Model Loaded model instance.
Clone this wiki locally