Repository navigation
Conversation
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. |
felixarntz
left a comment
There was a problem hiding this comment.
@joemcgill Thanks for opening the PR. I have a few points of feedback.
Most importantly, I think we need to ensure the directories stored in the global are always those of the initial site, which right now may not be the case.
|
Thanks for the quick feedback, @felixarntz. After giving it more thought, I had also come to the same conclusion that moving the memoization of the template paths to Originally, the template constants were set using the After [56635], those values were instead stored as static variables inside of As a compromise, I've updated the approach here so that a new function is added, |
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Thanks @joemcgill for the PR. Left some initial feedbacks.
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Great work, @joemcgill. It looks good from my perspective.
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
|
After reviewing all of the changes that were originally made in r56635, I believe the only safe way to make this change is to also use of the same globals in all the places where the previous constants were in use. I've applied those changes in the following functions: |
swissspidy
left a comment
There was a problem hiding this comment.
Just from looking at the code, the changes appear sound to me.
Feels a bit ironic that we end up replacing constants with globals :)
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Thanks @joemcgill for the update. LGTM! Left some nit-pick.
Agreed, and I feel the same. Essentially, we were using the old constants as a way to store the application state for template paths while the functions that are responsible for getting these values can change after the initial state is set. By keeping them as constants, any functions that relied on the old constants were not testable. However, trying to deprecate the constants in favor of using the functions directly caused several bugs due to the fact that these functions are used throughout the application in different ways than the state stored in the old constants and expect different values. Perhaps there is a different pattern that would be preferable to using globals in this case, but I didn't want to over-engineer something in order to fix the bugs that have been reported. |
It looks over-engineered to me already, and I'd use stronger language than "ironic" to describe the replacement of constants with globals. I just don't see enough evidence that these "bugs" are actually bugs at all. What it looks like to me is the real bugs got coincidentally fixed and a small number of vocal theme/plugin authors complained because they were relying on the bugs and were forced to update their theme/plugin. By the time this patch gets committed and deployed, which I hope it doesn't, anyone affected will have found other solutions already and it will serve no purpose other than to frustrate many other plugin/theme authors who want functions that behave in simple and consistent ways and are easy to learn. This kind of thing makes people want to stop authoring themes/plugins altogether, and most of them just leave quietly without making their frustrations known. Some core decisions that I've seen recently have been so perplexing that it made me honestly question whether "shooing" plugin/theme authors is the intention. If so, then go right ahead and commit this, but I'm still perplexed. If not, maybe reflect on why it so often looks that way. It seems there is often too much attention on designing a solution and not enough effort to define the problem. |
|
@joemcgill Thanks for your time on this PR - I think it works to solve the multisite issues we discussed in ticket #60290 and restores previously expected functionality. Will this make it into 6.5? |
|
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. |
|
@metropoliscreative I previously suggested an alternative for you in ticket 60290 that you could use immediately without a core patch. I would be interested to know whether it achieves what you're looking for. |
@carlomanf Yes, thanks for your feedback. I understand you have strong opinions about this ticket and PR, but the goal here is to address unintended functionality changes from [56635] related to |
|
@metropoliscreative Let me quote the part I am referring to, in case you missed it:
The point I am making is that 6.5 is more than a month away, a number of core committers above have expressed concern about the design of this patch, and there is potentially a way for you to independently solve the problem you encountered. Maybe you are already doing something like this, but it would assist everyone involved to find a way forward if you could confirm. |
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
|
Merged in https://core.trac.wordpress.org/changeset/57685. Thanks all for the feedback and testing. |
This change updates
locate_template()so that the stylesheet and template paths get stored to a global variable the first time this function is called and resets these globals any time the theme is switched. This memoizes these values similarly to how the previousSTYLESHEETPATHandTEMPLATEPATHconstants were stored prior to https://core.trac.wordpress.org/changeset/56635, but allows these values to be reset when the theme is switched. However, this avoids changing the template path whenever running in aswitch_to_blogcontext.Trac ticket: https://core.trac.wordpress.org/ticket/60290
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.