List of important WordPress hooks:
administrator_models
add_filter( 'administrator_models', function( $models ) { ... } );
Triggered during admin init, to initialize the Add-on.
Parameters
Parameter |
Data type |
Description |
$models |
array |
Array with the list of registered settings models. |
Returns
Data type |
Description |
array |
Array with the list of registered settings models. |
administrator_controls
add_filter( 'administrator_controls', function( $controls ) { ... } );
Triggered during admin init, to initialize the Add-on.
Parameters
Parameter |
Data type |
Description |
$controls |
array |
Array with the list of registered controls. |
Returns
Data type |
Description |
array |
Array with the list of registered controls. |
administrator_no_value_fields
add_filter( 'administrator_no_value_fields', function( $types ) { ... } );
Returns list of control types that do not handle values (i.e. section_open
, callback
and similar).
Parameters
Parameter |
Data type |
Description |
$types |
array |
Control types. |
Returns
Data type |
Description |
array |
Control types. |
administrator_bool_fields
add_filter( 'administrator_bool_fields', function( $types ) { ... } );
Returns list of control types that should behave as boolean
, specially the moment the Add-on tries to read its value from the POST data. (i.e. checkbox
).
Parameters
Parameter |
Data type |
Description |
$types |
array |
Control types. |
Returns
Data type |
Description |
array |
Control types. |
administrator_preload_model_{model_id}
add_filter( 'administrator_preload_model_{model_id}', function( $model, $current_tab ) { ... }, 10, 2 );
Triggered before the model is loaded, right after the $model
and $current_tab
are identified.
Parameters
Parameter |
Data type |
Description |
$model |
object |
Settings model. |
$current_tab |
string |
Current tab. |
Returns
Data type |
Description |
object |
Settings model. |
administrator_settings_before_save_{model_id}
add_filter( 'administrator_settings_before_save_{model_id}', function( $model, $current_tab ) { ... }, 10, 2 );
Triggered before the model is saved, right after the $model
has been loaded from the database.
Parameters
Parameter |
Data type |
Description |
$model |
object |
Settings model. |
$current_tab |
string |
Current tab. |
Returns
Data type |
Description |
object |
Settings model. |
administrator_settings_saved_{model_id}
add_action( 'administrator_settings_saved_{model_id}', function( $model, $current_tab ) { ... }, 10, 2 );
Triggered right after the model is saved in the database.
Parameters
Parameter |
Data type |
Description |
$model |
object |
Settings model. |
$current_tab |
string |
Current tab. |
administrator_model_{model_id}
add_filter( 'administrator_model_{model_id}', function( $model, $current_tab ) { ... }, 10, 2 );
Triggered before rendering, after the $model
has been loaded and saved.
Parameters
Parameter |
Data type |
Description |
$model |
object |
Settings model. |
$current_tab |
string |
Current tab. |
Returns
Data type |
Description |
object |
Settings model. |
administrator_model_fields_{model_id}
add_filter( 'administrator_model_fields_{model_id}', function( $fields, $model, $current_tab ) { ... }, 10, 3 );
Triggered after fields have been processed, before rendering.
Parameters
Parameter |
Data type |
Description |
$fields |
array |
Processed fields. |
$model |
object |
Settings model. |
$current_tab |
string |
Current tab. |
Returns
Data type |
Description |
array |
Processed fields. |