首页 WordPress函数大全 get_settings_errors()

get_settings_errors()

2020-05-01 / 5186阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_settings_errors( string $setting = '', boolean $sanitize = false )

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 the ‘admin_notices’ action hook).

参数

$setting

(string)
(Optional)
slug title of a specific setting whose errors you want.

Default value: ''

$sanitize

(boolean)
(Optional)
Whether to re-sanitize the setting value before returning errors.

Default value: false

返回

(array) Array of settings errors.

大家谈论
    我的见解