New answers tagged

0

Okay figured it out. In the function which does the validation I could get the original values which were saved in the database from the get_option function. //The option name which is set in the second argument in the register_setting function get_option( 'option_name' ); After that I could set input value to the old value if the error condition was met....


1

Looks like your validation argument is negative. if ($foo != "") { //means if foo not equal to empty space // do something when not empty // here you are setting an error } else { // do something when empty // here you are trying to do your normal operation } You are setting an error when you have data and then trying to process data when you have ...


0

It's not clear to me what the "test" button is for, which I guess could make a difference, but, in general, I have found that to make two buttons work independently on the same options page, the easiest thing is to place them within two separately defined forms, even if the two buttons are going to be placed side by side. The simplest method is just to ...


2

$callback = NULL means there is the $callback variable but it has no the value. In this case, unless you add any setting fields by add_setting_field() and register those settings by register_setting(), you'll get the Settings subheader on the Settings page without any content in this section. Here is an old tutorial which can be useful to show what I'm ...



Top 50 recent answers are included