I wanted to develop a duplicate General Settings Page instead of the built in one and all the settings on the built-in General Settings Page will also be displayed on the new General Settings Page.. the purpose of this is add some codes like inserting some options of a new table. How to accomplish this?


You don’t. You would have to keep your new page in sync with the core file each time WordPress is updated … that would not be very pragmatic.
Hook into the do_settings_sections('general'); with register_setting() and add your code here.

There is a third parameter for register_setting(): you can register a callback function here which used before the value is saved to the database.

See the @Otto’s WordPress Settings API Tutorial for some examples. In one of my own plugins I do the same: Public Contact Data. See the method function add_contact_fields() for details.

  • I basically want to run a mysql query upon submission of the general settings form.. like inserting the site title to a new table.. i want to accomplish this.. – Ken Jun 11 '12 at 11:40
  • @Ken See my update. – fuxia Jun 11 '12 at 11:45
  • If I understand correct you only wish to change the site title from the options-general.php and from a custom theme options page themes.php?page=theme_options? In that case I've recently asked a similar question here: wpquestions.com/question/show/id/4052 (just about the WP tagline) – user5424 Jun 11 '12 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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