[wp-trac] [WordPress Trac] #59969: Conditional loading `build_template_part_block_variations` for performance improvement
WordPress Trac
noreply at wordpress.org
Thu Nov 30 14:05:02 UTC 2023
#59969: Conditional loading `build_template_part_block_variations` for performance
improvement
-------------------------------------------------+-------------------------
Reporter: thekt12 | Owner: thekt12
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.5
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion needs-unit- | Focuses:
tests | performance
-------------------------------------------------+-------------------------
Comment (by spacedmonkey):
Basically in my [https://github.com/WordPress/wordpress-develop/pull/4857
PR], I use magic getter, to only load block variations, when the property
on the class is needed. This property is only need in the admin context
and not on the front end. Loading block variations in the context of
template parts, results in a very expensive load WP_Query that results in
many database calls.
I went with magic getter, this is bad pattern in PHP development, but it
is the most backwards compatible way of making this change.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59969#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list