Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get settings errors


Fetch settings errors registered by add_settings_error().

Checks the $wp_settings_errors array for any errors declared during the current pageload and returns them.

If changes were just submitted ($_GET['settings-updated']) and settings errors were saved to the 'settings_errors' transient then those errors will be returned instead. This is used to pass errors back across pageloads.

Use the $sanitize argument to manually re-sanitize the option before returning errors. This is useful if you have errors or notices you want to show even when the user hasn't submitted data (i.e. when they first load an options page, or in admin_notices action hook)


<?php get_settings_errors$setting$sanitize ?>


(string) (optional) Optional slug title of a specific setting whose errors you want.
Default: None
(boolean) (optional) Whether to re-sanitize the setting value before returning errors.
Default: false

Return Values

Array of settings errors.
    'setting' =>  $setting,
    'code'    =>  $code,
    'message' =>  $message,
    'type'    =>  $type



Change Log

Since: 3.0

Source File

get_settings_errors() is located in wp-admin/includes/template.php.


Settings API: register_setting(), unregister_setting(), add_settings_field(), add_settings_section(), add_settings_error(), get_settings_errors(), settings_errors()

See also index of Function Reference and index of Template Tags.