-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove duplicate call to locate_block_template()
#4443
Conversation
I ran a profiling test against the current trunk, and it showed that removing some function calls improved performance. This might be of interest to @felixarntz, @spacedmonkey, @eclarke1, and @joemcgill. ![]() |
@ockham Do you mind providing some context why this function needs to called twice? |
I looked around a bit, and this looks indeed like an oversight. As I said in this comment on the corresponding Trac ticket:
To unfurl the call stack a bit: The code that this PR removes loops over all template types and adds
The LOC directly before that line (and its comment block) is the "other" call to
So it looks pretty safe indeed to remove the filters from the hook! I've done a bit of smoke testing, and things seem to continue to work fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find @dlh01 😄
As elaborated in my comment, I think this is safe to land
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlh01 Can we add a PHPUnit test (pretty much an integration test) to ensure this doesn't break the template loading logic?
Apologies, @felixarntz, but could you elaborate about the template-loading outcome(s) that should be tested? |
@dlh01 Fair question. Taking another look, this change is probably irrelevant to any testing. However, as far as I can tell there are no tests at all for the block template specific bits of the To unblock this PR, I'm happy to approve this, but it would be great if you could use a separate PR to add at least some basic test coverage to ensure that |
Sure thing! I'll open a new ticket when I have those tests ready. |
Committed 02ea2f1 |
Trac ticket: https://core.trac.wordpress.org/ticket/58299
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.