[wp-trac] [WordPress Trac] #61112: Avoid re-constructing `WP_Theme_JSON` object from raw theme_json, instead use `WP_Theme_JSON` object inside `WP_Theme_JSON_data`

WordPress Trac noreply at wordpress.org
Thu May 30 21:08:28 UTC 2024


#61112: Avoid re-constructing `WP_Theme_JSON` object from raw theme_json, instead
use `WP_Theme_JSON` object inside `WP_Theme_JSON_data`
--------------------------+--------------------------
 Reporter:  thekt12       |       Owner:  thekt12
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  6.6
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+--------------------------

Comment (by ryelle):

 I spoke too soon, and found the issue @dd32 mentioned (I didn't realize it
 was a separate case). In that case, there's a plugin that calls
 `WP_Theme_JSON_Data_Gutenberg` directly (it's returned from the
 `wp_theme_json_data_theme` filter, which then tries to get
 `...->get_theme_json()`, causing the error).

 While that's probably not best practice,
 [https://wpdirectory.net/search/01HZ5MC38A8XWE9ETKVJC77CXR there are at
 least two plugins doing it], so it probably is better to add the shim in
 case others run into this.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61112#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list