add_settings_error ( $setting, $code, $message, $type = 'error' )
- 参数
-
-
(string)
$setting
Slug title of the setting to which this error applies.- Required: 是
-
(string)
$code
Slug-name to identify the error. Used as part of ‘id’ attribute in HTML output.- Required: 是
-
(string)
$message
The formatted message text to display to the user (will be shown inside styled `` and `` tags).
- Required: 是
- (string)
$type
Optional. Message type, controls HTML class. Possible values include ‘error’, ‘success’, ‘warning’, ‘info’. Default ‘error’.- Required: 否
- Default: ‘error’
- 定义位置
-
-
wp-admin/includes/template.php
, line 1816
-
wp-admin/includes/template.php
- 引入
- 3.0.0
- 弃用
- –
Registers a settings error to be displayed to the user.
Part of the Settings API. Use this to show messages to users about settings validation
problems, missing settings or anything else.Settings errors should be added inside the $sanitize_callback function defined in
register_setting() for a given setting to give feedback about the submission.By default messages will show immediately after the submission that generated the error.
Additional calls to settings_errors() can be used to show errors even when the settings
page is first accessed.function add_settings_error( $setting, $code, $message, $type = 'error' ) { global $wp_settings_errors; $wp_settings_errors[] = array( 'setting' => $setting, 'code' => $code, 'message' => $message, 'type' => $type, ); }
-
(string)
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。