Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am confused. Want to save data for my plugin. There are people who use add_options and there are others who use register_settings. My question is What is difference between add_options and register_setting?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

register_setting() uses Settings API, which is just an API for options.php, is easier to use, more secure and preffered way of storing options since WordPress 2.7.

If you need to store only a few options or doing simple plugin just for yourself - it's really up to you which one to use :)

Here's the Settings API (well) explained: http://www.chipbennett.net/2011/02/17/incorporating-the-settings-api-in-wordpress-themes/

Basically it makes a few things much easier, you don't have to render whole forms all over again (great for plugins/themes with many options), you don't need to care about nonces etc.

So, to sum up, both these functions actually do the same thing :)

share|improve this answer
1  
an example, there you can use svn.wp-plugins.org/addquicktag/trunk/inc/class-settings.php –  bueltge Apr 24 '12 at 13:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.