Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7783963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:59:52+00:00 2026-06-01T19:59:52+00:00

In the WordPress Settings API, creating a new options page usually starts out with

  • 0

In the WordPress Settings API, creating a new options page usually starts out with

register_setting('sample_options', 'my_option');
add_settings_section('section', 'Sample Options', 'callback1', 'page');
add_settings_field('name', 'Label', 'callback2', 'page', 'section');

In this simplified example, the data gets saved in the option my_option making the value of name accessible through

$option = get_option('my_option');
$name = $option['name']; // Got it

But what if the value of the name field is there not to place a new value but to update an already existing option that’s not my_option like for example this_other_option? I guess what I’m really looking for is is it possible for one field to save to multiple options (my_option and this_other_option) while using the Settings API?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:59:53+00:00Added an answer on June 1, 2026 at 7:59 pm

    I suppose you could use a callback in register_setting. It would look something like the following:

    <?php
    register_setting('sample_options', 'my_option', 'my_sanitize_callback');
    
    function my_sanitize_callback($value, $option) {
        $value = mysql_real_escape_string($value);
        update_option('my_other_option', $value);
        return $value;
    }
    ?>
    

    You may have to tweak that a bit. I haven’t tested it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add some settings to my WordPress options page that depend on
I have a WordPress plugin with settings page. On this settings page, the form
If you go to wordpress admin and then settings->privacy , there are two options
I have a wordpress blog theme settings page using functions.php How can i send
I’m farely new to Wordpress but are working on putting a page together which
Frustrated SO regular here: I'm creating a theme-options.php page for a child theme in
I have configured WordPress to display a static front page as described here: http://codex.wordpress.org/Settings_Reading_SubPanel#Reading_Settings
I developed a plugin with Settings link that was working fine in WordPress 2.7.
I want to add custom attribute settings to a generated anchor link of Wordpress.
My wordpress is not setting the front page correctly, I have several pages, all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.