-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Code quality check for theme.json related APIs #45171
Copy link
Copy link
Open
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonNeeds Dev NoteRequires a developer note for a major WordPress release cycleRequires a developer note for a major WordPress release cycle[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonNeeds Dev NoteRequires a developer note for a major WordPress release cycleRequires a developer note for a major WordPress release cycle[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This issue tracks the current state of
theme.jsonrelated APIs from a quality point of view, so we can bring up, discuss and address the issues.WordPress 6.2: shipped
Public API:
wp_theme_has_theme_json. #45168 #45380Performance:
wp_theme_has_theme_json: cache output #45543wp_get_global_settings: cache output #45372 #45971 #45969wp_get_global_stylesheet: migrate from transient to object cache #45679wp_get_global_styles_svg_filters: migrate from transient to object cache #47460 (done in core as the function was removed from Gutenberg)Sync WordPress core <=> Gutenberg:
WP_Theme_JSONclass instead of inheriting per WordPress version #46579WP_Theme_JSON_Resolverclass instead of inheriting per WordPress version #46750WordPress 6.3: shipped
Public API
gutenberg_get_remote_theme_patternsfunction #49307block.jsonAPI: consider graduating__experimentalSelectorand__experimentalDuotonefrom experimental to stable #45194wp_get_global_styles: for custom props, it should return the CSS format not the shortened internal one #49693wp_get_global_styles: return values instead of CSS Custom Properties #49712WordPress 6.4: ongoing
Performance:
get_root_layout_rules: remove unnecessary call tosanitize_title#53568theme.json: skip those without classes or variables #53574gutenberg_get_global_settingsinstead of private API #53805compute_style_propertiesby reducing the number of iterations it performs #51983wp_get_global_settingsinstead of private API wordpress-develop#4980WP_Theme_JSONinstances #53357get_style_nodes: only return those that will be used #53575Public API
wp_get_theme_data_template_parts: create public API to accesstemplatePartsfromtheme.jsonwordpress-develop#4971wp_get_theme_data_custom_templateswordpress-develop#5031Next
Algorithm:
Public API:
WP_Theme_JSONorWP_Theme_JSON_Resolverare covered by the addition of public methods.customTemplatesandtemplateAreasmetadata with the actual data they represent (templates and template parts provided by the theme asHTML) and remove them fromtheme.json. #42732 In testing #38984 we ran into an issue with valid HTML comments that don't belong to a block #47212wp_theme_json_get_style_nodesfilter #45172 Filters, together with methods or thetheme.jsondatum, are all part of the public API. We should aim to not expose private implementation details in the public API that prevent us from evolving it.wp_get_global_styles: resolver the reference to the value #49715Performance
theme.json) cache usage is enabled through a dedicated function #45912wp_get_global_styles: add object cache.wp_add_global_styles_for_blocks: review status.get_stylesheet(renders the top-level styles) andget_styles_for_block(renders the block-level styles). Potential optimizations:theme.jsonnodes of the blocks in use. At the moment all are processed (seewp_add_global_styles_for_blocks), though only the blocks in use get enqueued.