You can use the wordpress Options API without the Settings API (but you can’t use Settings API without Options API)

Store a value or array

  $MyStoredSetting = "something...";

  update_option('MY_UNIQUE_SETTING_NAME', $MyStoredSetting , True);       //If the option does not exist it will be created.  autoload=True(load the option when WordPress starts up)

Read stored value or array

You don’t have to stored a value first, get_option() will return False if none found.

$MyStoredSetting can be a value or an array, get_option() will serialise it if necessary

  
  if (!$MyStoredSetting = get_option('MY_UNIQUE_SETTING_NAME'))
    $MyStoredSetting = "";

Delete a stored setting

  delete_option('MY_UNIQUE_SETTING_NAME');

Add a new stored setting

You can use this if you wish, but update_option() will create a new setting if it doesn’t already exist

  add_option('MY_UNIQUE_SETTING_NAME', 'options_value', True);       //autoload=True(load the option when WordPress starts up)
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published.