#59137 closed enhancement (fixed)
Add `wp_get_theme_data_custom_templates` function
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.4 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Themes | Keywords: | has-patch commit |
| Focuses: | Cc: |
Description
We lack a public function wp_get_theme_data_custom_templates to offer access to metadata stored under customTemplates in theme.json.
## Why
There is a no public function to get access to that data, so consumers need to resort to private APIs. This follows the steps of wp_get_global_settings, wp_theme_has_theme_json, wp_get_theme_directory_pattern_slugs, and wp_get_theme_data_template_parts.
Change History (11)
This ticket was mentioned in PR #5031 on WordPress/wordpress-develop by @oandregal.
2 years ago
#1
- Keywords has-patch added
#2
@
2 years ago
- Keywords commit added
Thanks for the ticket and patch,
Marking this as ready for commit.
@oandregal commented on PR #5031:
2 years ago
#4
This function is missing a return statement and its @return tag is incorrect. Can you check and correct those please?
Thanks, @johnbillion for catching the issue. Both things addressed.
@audrasjb commented on PR #5031:
2 years ago
#5
Ah correct.
The change looks good to me, but we usually add a line break on long docblock sentences to avoid having too much characters on the same line
@oandregal commented on PR #5031:
2 years ago
#6
The change looks good to me, but we usually add a line break on long docblock sentences to avoid having too much characters on the same line
Added the line break as well.
@oandregal commented on PR #5031:
2 years ago
#7
Looking for how we do @return in other functions, I've noticed this https://github.com/WordPress/wordpress-develop/pull/5033
@oandregal commented on PR #5031:
2 years ago
#8
@johnbillion when you have the time, can you clear up the blocker so I can commit this?
@oandregal commented on PR #5031:
2 years ago
#11
Committed at https://core.trac.wordpress.org/changeset/56413.
Part of https://github.com/WordPress/gutenberg/issues/45171
Trac ticket: https://core.trac.wordpress.org/ticket/59137
## What
This PR adds a new public function
wp_get_theme_data_custom_templatesto offer access to metadata stored undercustomTemplatesintheme.json.## Why
There is a no public function to get access to that data, so consumers need to resort to private APIs. This follows the steps of
wp_get_global_settings,wp_theme_has_theme_json,wp_get_theme_directory_pattern_slugs, andwp_get_theme_data_template_parts.## How
It creates a new function that uses the private calls and substitutes all the instances of the old one in the codebase.
## How to test
TBD.
## Commit message