Options

Options provide a simple and standardized way of storing data in the database. The functions makes it easy to create, access, update, and delete options. All the data is stored in the alte_options table under a given option name.

Structure

// Create/Update Option to the database
set_option($name, $value)

//Get option by name
get_option($name)

//Delete option by name
delete_option($name)

Example Usage

//create an option to store user name
set_option('username','adminer');

//retrieve the stored username
echo get_option('username');

//delete the username
delete_option('username');

Notes

  • Option names are unique, if you set an option with an existing option name, that option value will be updated to the provided value, so be careful

  • If you store a json string in an option, when you get the option, it will already be decoded and you will get an array back ready for your usage

  • You can store: html, strings, json, numbers etc in the option values for your usage around the application

  • Admiro uses the options to store the app settings and configurations. You can export this configs under general settings menu and import them whenever you wish

Last updated