Skip to main content
Remove a broken link.
Source Link
chrisguitarguy
  • 21.5k
  • 5
  • 62
  • 99

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option is found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the notoptions array first so it doesn't waste time checking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can tracethe source for get_option to see what's going on.

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option is found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the notoptions array first so it doesn't waste time checking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can trace what's going on.

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option is found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the notoptions array first so it doesn't waste time checking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the source for get_option to see what's going on.

edited body
Source Link
chrisguitarguy
  • 21.5k
  • 5
  • 62
  • 99

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option ifis found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the not optionnotoptions array first so it doesn't waste time checking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can trace what's going on.

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option if found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the not option array first so it doesn't waste time checking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can trace what's going on.

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option is found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the notoptions array first so it doesn't waste time checking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can trace what's going on.

added 3 characters in body
Source Link
chrisguitarguy
  • 21.5k
  • 5
  • 62
  • 99

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option if found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the not option array first so it doesn't waste time checkchecking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can trace what's going on.

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option if found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the not option array first so it doesn't waste time check for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can trace what's going on.

Yes, sort of. When the get_option call is made, WordPress runs a function called wp_load_alloptions, which either grabs a cached copy of all autoloaded options or loads all those options into the cache. Then wp_load_alloptions returns an array of all the autoloaded options. If your option is autoloaded (specified when you use the add_option function), it will be part of this array and get returned.

If your option is not auto loaded, WordPress then looks in the cache specifically for that option and returns the value if it's there. If that misses, the final fallback is to go to the database, fetch the value, set it the cache and then return it.

Finally, if no option if found at all (eg. the option name was invalid), WordPress stores that option's name in a cached array called notoptions. If subsequent calls to the non-option are made, WP checks the not option array first so it doesn't waste time checking for something that isn't there.

If you're worried about calling get_option multiple times per page load, don't be. WordPress will cache the option value after the first get_option call regardless of whether or not its autoloaded.

Check out the get_option function in phpxref and you can trace what's going on.

added 300 characters in body
Source Link
chrisguitarguy
  • 21.5k
  • 5
  • 62
  • 99
Loading
Source Link
chrisguitarguy
  • 21.5k
  • 5
  • 62
  • 99
Loading