[wp-trac] [WordPress Trac] #62574: Move default template types and template part areas to REST API

WordPress Trac noreply at wordpress.org
Fri Feb 14 23:48:11 UTC 2025


#62574: Move default template types and template part areas to REST API
---------------------------------------+-----------------------
 Reporter:  gigitux                    |       Owner:  gigitux
     Type:  enhancement                |      Status:  assigned
 Priority:  normal                     |   Milestone:  6.8
Component:  Editor                     |     Version:
 Severity:  normal                     |  Resolution:
 Keywords:  has-patch gutenberg-merge  |     Focuses:
---------------------------------------+-----------------------

Comment (by joemcgill):

 To help move this forward, I think tying this to the ongoing discussion in
 #48885 conflates two unrelated issues.

 That ticket is specifically about how to expose read only access to
 registered settings (i.e. options). Given that the default template types
 and allowed template part areas are not stored as options, but are instead
 [https://github.com/WordPress/wordpress-
 develop/blob/03834fec6848fe433045a3b19b1b45236140c3e4/src/wp-includes
 /block-template-utils.php#L51-L226 defined in code], the same concerns
 don't apply here, as these are not "settings" in the way the
 `wp/v2/settings` endpoint defines them.

 That said, I think question that does still need to be answered is where
 is the appropriate place to expose this data since `wp/v2/settings` is
 inappropriate and `wp/v2/templates` and `wp/v2/template-parts` are meant
 to return a representation of a `WP_Block_Template` object.

 I'd be more comfortable adding this to the index if were only exposed to
 logged in users given that these values can be modified by themes and
 plugins to include data that may not be meant to be public. If doing so, I
 would add this as a filter on the `rest_index` callback, similar to how
 the application passwords data is added via
 `rest_add_application_passwords_to_index()`.

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


More information about the wp-trac mailing list