public function database_name_check($input){
//debug
add_settings_error('notice', 'lol', 'lol');
if($this->wpdb->get_var($this->wpdb->prepare('SHOW DATABASES LIKE %s', $input)) == $input)
return $input;
else{
add_settings_error('notice', 'lol', 'lol');
return FALSE;
}
}
I can not understand why the error does not exceed, any suggestions?
Take a look at the
add_settings_error
prototype.The first argument is your settings name/key — or if your setting is on another page (eg
general
) it should be the page key. The second is whatever you’d like to add to the ID attribute, then error/updated message, and finally type. It doesn’t work because you’re using it incorrectly.So you probably want…
You also need to tell WordPress to display your settings errors. If it’s on a custom page, you’ll need to include
settings_errors
in the callback.