Filter
rpress_settings_sanitize_{$type}
On this page
Filters a setting value during sanitization, per field type.
Runs for each submitted setting while the settings form is saved, with the registered field type in the hook name, such as text or checkbox. It runs before the generic rpress_settings_sanitize filter. Return the cleaned value.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$value | mixed | The submitted value for the setting. |
$key | string | The setting key. |
Return value#
mixed. The sanitized value.
Example#
function my_sanitize_text_setting( $value, $key ) {
return is_string( $value ) ? trim( $value ) : $value;
}
add_filter( 'rpress_settings_sanitize_text', 'my_sanitize_text_setting', 10, 2 );
Notes#
The built-in sanitizer for text fields (rpress_sanitize_text_field) is attached to rpress_settings_sanitize_text.
Source#
Applied in:
includes/admin/settings/register-settings.php(line 1910), inrpress_settings_sanitize()
See also#
Was this page helpful?
