Wordpress API settings not savnig

I have a pretty simple settings page for my plugin. here is the code: http://pastebin.com/k5jeZ9aw

It has just one text field and shows fine. However it does not save. Actually, when it gets to method 'validate_setting' it gets a void parameter (I assume it should get the value of the field).

I don't get neither any js errors nor wordpress debug errors.

I don't know if the problem is due to the fact of being using a class, but it does not complain about not finding any function.

Please anybody could help me?

Thanks in advance.


Well, after the whole morning dealing with it, just 15 minutes after having posted my doubt, I found out the problem. The code seems to be fine but I had some place else some other settings with same registered settings name. When I changed the name it started saving data properly. It would be nice if it threw some warning when this occures (two plugins with same settings name) but it does not complain at all.

It is not a common error but I hope this helps somebody some day.


PS: I don't know if I should tag this answer as closed (considering it is my own question), or how to close it.

Similar questions

Settings API: Two update notices after saving settings?
I've used the settings API to create a very simple page for plugin settings. This is my first time using the API, and through various tutorials online and answers here, I think I've figured it out. This is backed up by the fact that the page even works!! However, something weird is happening: As you can see above, there are two div.update messages ...
Dynamic settings fields with Settings API
I am at my first Settings API application and I hit a snag. In a submenu page, I need to generate a number of fields (say color picker) for each of the values retrieved from another setting. To be more precise, I created in another menu page a list of category checkboxes: In my second options page, I use the option values to generate the appropriat...
Theme settings Page: Settings Api vs Update_Options
I’m a new WordPress developer trying to start a carrier selling Premium Themes. In the last week, I’ve been confronted to many difficulties trying to understand how to create a theme options page. At the end I’ve finally understood the way I should do it using the settings api. Then, I tried to customize the setting page style, to add some jQuery f...
How to handel multiple checkbox field in the admin settings page with Settings API
I'm trying to incorporate a list of checkbox in my plugin's admin settings page from which users can select a few countries from the list of all countries. So far I've done this: Please Note: This is not the entire code, but a short part of it to give you guys the idea about my question. Now as you can see I'm using checkboxes above I want all the ...
Using the WooCommerce Settings API, how can I filter or add errors to settings values?
The WooCommerce Settings API documentation gives just enough information to get settings added to Gateway/Shipping Method screens. However, unlike the native WordPress Settings API, there are no documented "sanitize" callbacks, like WordPress' register_setting() has. Thus, if invalid content is supplied, I'm not sure where I'm supposed to be able t...
Wordpress settings page not saving settings to database
I am developing my first Wordpress plugin. I've been following some guides on creating a settings page. I have the following page which correctly displays the value of the fields in the database. When I go to the page, edit the fields and press "Save changes" the changes aren't saved to the database. If I change the values directly in the database,...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.