Options, Meta APIs: Expand `$autoload` parameter documentation.
This changeset expands documentation of the `$autoload` parameter of the `add_option()` and `update_option()` functions, in order to provide more context on what autoloading is and which considerations should go into the decision whether to autoload an option. Excessive autoloading of options can lead to severe performance problems on some sites, and lack of documentation is a partial cause for the issue. Props rajinsharwar. Fixes #58963. Built from https://develop.svn.wordpress.org/trunk@56370 git-svn-id: http://core.svn.wordpress.org/trunk@55882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2ecfc4f9a0
commit
65a442fbcd
|
@ -428,8 +428,13 @@ function wp_load_core_site_options( $network_id = null ) {
|
|||
* @param mixed $value Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
|
||||
* @param string|bool $autoload Optional. Whether to load the option when WordPress starts up. For existing options,
|
||||
* `$autoload` can only be updated using `update_option()` if `$value` is also changed.
|
||||
* Accepts 'yes'|true to enable or 'no'|false to disable. For non-existent options,
|
||||
* the default value is 'yes'. Default null.
|
||||
* Accepts 'yes'|true to enable or 'no'|false to disable.
|
||||
* Autoloading too many options can lead to performance problems, especially if the
|
||||
* options are not frequently used. For options which are accessed across several places
|
||||
* in the frontend, it is recommended to autoload them, by using 'yes'|true.
|
||||
* For options which are accessed only on few specific URLs, it is recommended
|
||||
* to not autoload them, by using 'no'|false. For non-existent options, the default value
|
||||
* is 'yes'. Default null.
|
||||
* @return bool True if the value was updated, false otherwise.
|
||||
*/
|
||||
function update_option( $option, $value, $autoload = null ) {
|
||||
|
@ -615,7 +620,12 @@ function update_option( $option, $value, $autoload = null ) {
|
|||
* Expected to not be SQL-escaped.
|
||||
* @param string $deprecated Optional. Description. Not used anymore.
|
||||
* @param string|bool $autoload Optional. Whether to load the option when WordPress starts up.
|
||||
* Default is enabled. Accepts 'no' to disable for legacy reasons.
|
||||
* Accepts 'yes'|true to enable or 'no'|false to disable.
|
||||
* Autoloading too many options can lead to performance problems, especially if the
|
||||
* options are not frequently used. For options which are accessed across several places
|
||||
* in the frontend, it is recommended to autoload them, by using 'yes'|true.
|
||||
* For options which are accessed only on few specific URLs, it is recommended
|
||||
* to not autoload them, by using 'no'|false. Default 'yes'.
|
||||
* @return bool True if the option was added, false otherwise.
|
||||
*/
|
||||
function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-alpha-56365';
|
||||
$wp_version = '6.4-alpha-56370';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue