If you check the implementation of get_option()
you’ll see that in line 168 it calls wp_cache_get()
like so:
$value = wp_cache_get( $option, 'options' );
This means multiple calls to get_option("style_settings")
within the same PHP execution will be served from cache. There is no need to re-invent this, as you might break other functionality with it. (There are various filters and hooks in the get_option()
call with which plugins may interfere with this. Unless you have specific reasons, you usually want these to be executed.)
Related Posts:
- WordPress setting with select – where is my mistake?
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is get_option function cached?
- What are the advantages to the Settings API?
- Where to store plugin settings fields
- What’s the best method for emptying an option created with the Settings API?
- Why won’t register_setting() create a setting?
- Extend plugin options page
- Can I use the different settings sections over different pages using the save options group?
- Correct way check nonce (security) using old Options API
- How to add settings subpage from a plugin to a settings page created in theme?
- Remove Internal Style Sheet if no Value Provided?
- Custom delete option button in plugin settings
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- Update problem with update_option() in combination with register_setting()
- Issue on Checkbox with Custom Option Page
- Settings API: Setting default option via ‘get_option’ fails
- What could cause a WP Option to get truncated?
- update_option() passing empty array() but still updating
- Plugin setting page – update_option problem
- add_settings_error on validating plugin options API
- How do I build a settings panel under the plugin
- Add_menu_page and saving settings
- Options don’t save, validation callback not executed
- Settings API not Saving to Database or Display
- Admin Message after Plugin Option Updated
- Update Option Stored in Multi-Dimensional Array
- Adding Widget form fields dynamically
- Releasing new plugin version, how to rename old options keys?
- How to properly sanitize strings for update_option()
- Custom plugin settings: clicking “save changes” does not display success message
- How do I handle multiple Submit buttons in plugin’s option page?
- Add Admin Menu Inside Construct or Init
- Settings API – Undefined Index when unchecking checkbox
- Disable $title in Plugin Options Screen?
- WordPress Settings API: saving multiple rows of similar data
- Dropdown list of pages to get page id to store in plugin options
- update_option is not working!
- Save user-specific options in WordPress admin
- Creating option to allow user to select the page my plugin content will display on
- Unified Approach for Placing Option Pages
- Does settings API create settings on run time?
- WordPress plugin options and jQuery
- WordPress Plugin Setting’s POST
- plugin development: storing language specific options
- How to add a secondary button to a settings page with a custom action?
- Settings not set after calling register_setting()
- Using the Settings API, how should I add multiple values to an option?
- Plugin options not being saved or created
- What could cause my plugin’s options/settings page not to load?
- How to set “Site Address (URL)” programmatically on WP multisite?
- Serialize data for wp options
- Callback is not called in add_settings_field() when passed as part of an array, but recognises that it’s there. It’s passed Class to Class using OOP
- When to use add_settings_section vs just register_setting?
- Storing product price data in the database
- WP_Editor – Saving Value into Plugin Option – Stripping HTML
- Plugin development: can’t update settings with multiple settings sections
- Parse form values before sending to options.php
- Insert/Update values to a table after blogname option etc. is updated
- wordpress how to query wp_options table
- How Can I add Fields in wp-option table?
- Plugin Options Array Set to Undefined
- Checked() function on a multidimensional array
- How to add new options to my WordPress plugin
- The Correct Way to Use Nonce Field without Settings API
- how to save wp_editor html content in options table
- Custom Plugin Options Won’t Update
- settings api – add_settings_section not working
- custom wp_editor does not save the content in plugin settings
- Plugin settings are saving but the fields
- why does get_option( ‘home’ ) not work while using in plugin [closed]
- Plugin Options not saving options and doesn’t work
- Pause plugin option page until all data manipulation is complete
- How to make sure settings are not lost when plugin is updated?
- It is possible to pass $args that sent by add_settings_field() inside another function?
- Add multiple checkboxes as single field to Custom Shipping Method Settings Page
- How does one update complex options?
- Multiple checkbox doesn’t work in wordpress settings api
- Custom plugin: how do I call a PHP file if settings option is set to true?
- Sanitization and validation input fields – Settings API
- Plugins Settings page not updating
- How to create plugin settings page for each admin user?
- How Can I Update wp_enqueue_scripts () From WordPress Option Page Radio Buttons
- Array/List Edit in Backend
- How to Modify My Plugin’s Admin Settings so that the Plugin can be Added to a Specific Page?
- What should I use instead of get_blog_option?
- Tie specific functions to options-update for limiting API requests
- When using an options array the Settings API isn’t creating the database record
- Can’t switch theme after activation
- Generate activation url
- Validating values using Settings API?
- Settings API with arrays example
- the correct way to use options from settings page [closed]
- Saving multiple fields as array
- WordPress Plugin default option
- Modify a Themes Appearance >> Header admin screen from a plugin
- Update custom settings field in plugin
- Update option hook not firing
- How to use register_setting()
- WordPress plugin options page not saving options, no errors