Network & Sites: Introduce a general pre_site_option filter in get_network_option()#10030
Network & Sites: Introduce a general pre_site_option filter in get_network_option()#10030audrasjb wants to merge 3 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| * Returning a truthy value from the filter will effectively short-circuit retrieval | ||
| * and return the passed value instead. |
There was a problem hiding this comment.
| * Returning a truthy value from the filter will effectively short-circuit retrieval | |
| * and return the passed value instead. | |
| * Returning a value other than false from the filter will short-circuit retrieval | |
| * and return that value instead. |
It's a strict check on false, so some none truthy values (such as an empty array) would still short-circuit retrieval. I think we should use the same langauge as the filter above.
There was a problem hiding this comment.
Noting that the pre_option filter also needs to get fixed up for this as well since it too uses truthy.
| * from `$default`, which is used as the fallback value in the event | ||
| * the option doesn't exist elsewhere in get_network_option(). | ||
| * Default false (to skip past the short-circuit). | ||
| * @param string $option Name of the option. |
There was a problem hiding this comment.
nit: In pre_site_option_{$option} this is documented as "Option name." I think it would be for these two to be named the same. I prefer this one, so maybe we change the other filter?
| * @param mixed $pre The value to return instead of the network option value. This differs | ||
| * from `$default`, which is used as the fallback value in the event | ||
| * the option doesn't exist elsewhere in get_network_option(). | ||
| * Default false (to skip past the short-circuit). |
There was a problem hiding this comment.
| * Default false (to skip past the short-circuit). | |
| * Default false (to skip past the short-circuit). If this is not false, it was changed by `pre_site_option_{$option}` |
I think there is value on being clear about when this wouldn't be false.
https://core.trac.wordpress.org/ticket/56870