Introduce functions to set option autoload value independently in the database#5069
Introduce functions to set option autoload value independently in the database#5069felixarntz wants to merge 15 commits intoWordPress:trunkfrom
Conversation
joemcgill
left a comment
There was a problem hiding this comment.
I really like this. Thanks, @felixarntz. I have a couple questions inline, but am also wondering if we could simplify things by making wp_set_option_autoload() a wapper that passes a single value to wp_set_options_autoload() and avoid duplicating the query logic in two places?
|
@joemcgill In 40714a4, I have updated |
…ep logic for populating caches centralized when values are updated.
…allows setting different autoload values per option.
|
@boonebgorges @joemcgill This is now ready for another full review. |
joemcgill
left a comment
There was a problem hiding this comment.
This looks much cleaner after your updates, thanks @felixarntz!
| */ | ||
| function wp_set_options_autoload( array $options, $autoload ) { | ||
| return wp_set_option_autoload_values( | ||
| array_fill_keys( $options, $autoload ) |
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Thanks @felixarntz for the PR. Left nonblocking feedback.
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
costdev
left a comment
There was a problem hiding this comment.
Thanks for the updates @felixarntz! A couple more thoughts:
costdev
left a comment
There was a problem hiding this comment.
Thanks for the responses @felixarntz! That's all from me on this one 🙂
|
Committed in https://core.trac.wordpress.org/changeset/56508 |
Trac ticket: https://core.trac.wordpress.org/ticket/58964
This PR introduces
wp_set_option_autoload()andwp_set_options_autoload()functions, which allow updating theautoloadvalue for an option, or multiple using a single DB request.Both functions also handle updating the respective caches accordingly (
alloptionsvs individual option cache).This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.