[wp-trac] [WordPress Trac] #18298: deprecate TEMPLATEPATH and STYLESHEETPATH
WordPress Trac
noreply at wordpress.org
Wed Sep 6 20:45:09 UTC 2023
#18298: deprecate TEMPLATEPATH and STYLESHEETPATH
-------------------------------------------------+-------------------------
Reporter: aaroncampbell | Owner: thekt12
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.4
Component: Themes | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses: template,
testing | performance
-------------------------------------------------+-------------------------
Comment (by flixos90):
After reviewing the two PRs https://github.com/WordPress/wordpress-
develop/pull/4880 and https://github.com/WordPress/wordpress-
develop/pull/5156 and their benchmarks (thanks @thekt12!), I implemented
another alternative which is a combination of the two approaches in
https://github.com/WordPress/wordpress-develop/pull/5160:
* It uses the `get_*_directory()` functions instead of the constants.
* It uses globals to "cache" the results of the filter in memory so that
the respective filter is only run once per page load.
* The globals are reset whenever the active theme is switched, leading to
a recalculation of the result, which addresses the main limitation of the
constant approach.
I conducted a benchmark for this (see results above), and the differences
are minimal, with no clear indication in either direction, which makes me
think the difference in performance is tiny enough to be irrelevant. FWIW
that may be the case for the other approaches too if we conduct more
benchmarks for the PRs, at least that's what I'd suspect based on my
benchmarks.
I'd like to propose https://github.com/WordPress/wordpress-
develop/pull/5160 for consideration. If we go with this approach, we could
probably port over the tests from https://github.com/WordPress/wordpress-
develop/pull/4880 for additional coverage.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/18298#comment:55>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list