Enhance update_option
Functionality: Autoload Behavior Update and Documentation Improvements
#7679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trac Ticket: Core-48393
Summary
update_option
function in WordPress, enhancing its functionality and updating the corresponding documentation.Code Changes
Behavior Update:
If the user explicitly provides the $autoload parameter and it differs from the existing value, the autoload status will be updated even if the $value remains unchanged.
If both the $value and the $autoload parameters are the same as their existing values, the function will not perform an update.
When the $autoload parameter is set to null, it is assumed that the user has not provided a value for autoloading, and the decision to update will be based solely on the comparison of the old and new values.
Documentation Updates
Key Points
This change improves the flexibility of the update_option function, allowing for more granular control over option updates.
The documentation now accurately describes the behavior and implications of using the $autoload parameter.
Additional Notes