WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using add_settings_field to add some more details to a settings menu, but not sure how I save the settings, or call them back in my theme.

Here is the code thus far


function vimeo_setup(){
add_settings_field('vimeo_id','Vimeo ID','display_vimeo','general');

function display_vimeo(){

 echo '<input  type="text" name="vimeo_id" id="vimeo_id" value="" size="30" style="width:85%" />';
 echo '<p><small> Enter your Vimeo ID here.</small></p>';
share|improve this question
Still no answers? Just to clarify, my problem is it seems the settings are not being saved, I can't find them in the DB – Mild Fuzz Sep 10 '10 at 15:04
up vote 4 down vote accepted

Documentation for add_settings_field() Says following:

You MUST register any options used by this function with register_setting() or they won't be saved and updated automatically.

share|improve this answer

It should be noted that in order to add a settings field you must register that field to a registered section..

So this must be used alongside your own registered section, or alternatively be a field to add to an existing section (such as those throughout the options pages).

See. http://codex.wordpress.org/Function_Reference/add_settings_section

I would go so far as to say these are not really very good when it comes to building plugin options pages or alike(theme options), simply because every registered section and field must be provided with a callback (imagine how many callbacks you'll need if you have 3-4 sections all with 5-6 fields). You can of course make dynamic callbacks (so you only need one callback for a section and one for the fields) by passing along parameters... (you'll also need to make sure you print the nonces for these sections/fields)..

Personally i find it's better to just register your options/settings, and print out your own sections/fields, and call a single nonce to cover all your settings..

// 1: Reference, 2: Option name, 3: Callback function to sanitize the data
register_setting( 'reference_name', 'option_name', 'example_callback' );

Then wherever you print your various option fields, you only need print one nonce that covers the lot..

settings_fields( 'reference_name' ); 

If you registered various sections and fields you'd also have to do this for each of the registered sections.


Really the only important aspect of setting up custom options is to make sure you define your own callback when registering the settings and appropriately sanitizing that data (third parameter for register_setting).

share|improve this answer

Your Answer


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.