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.

In the WordPress settings API, I understand that register_setting() must be called for add_settings_field() to be saved and updated according to the codex.

Since almost every WordPress function has an ID, slug, name, key or whatever they might be called which links from one function to another, I don't see how register_setting( $option_group, $option_name) link to any settings api function.

$option_group is used when settings_field() is called.

Question 1: But what does that really do?

The second parameter $option_name is simple, get_option($option_name). Yes I unsderstand that.

Another function do_settings_sections(), from what I understand, is pretty simple. It asks for the slug / id / name of the page from add_options_page() you defined, which is linked to add_settings_section() and add_settings_field() in the same sensible manner (id / slug / name / etc).

So now for the main question: How does register_setting() knows which settings I'm relating to?

I'm sorry if I sound so confused, because maybe I AM confused.

Gladly appreciate any help guys. Thanks.

share|improve this question
    
Have you seen Settings API with arrays example? It is all explained there. –  toscho Oct 27 '13 at 1:30

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.