[wp-trac] [WordPress Trac] #56922: Template / Template parts revision / autosave REST API are broken

WordPress Trac noreply at wordpress.org
Mon Oct 9 22:44:43 UTC 2023


#56922: Template / Template parts revision / autosave REST API are broken
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.4
Component:  REST API                             |     Version:  4.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:  rest-api
  testing changes-requested                      |
-------------------------------------------------+-------------------------

Comment (by hellofromTonya):

 Flagging @spacedmonkey - What do you think with @antonvlasenko's
 observation and question (broken out and emphasis added)?

 >⚠️ In conclusion, the proposed patch successfully addresses the issue.
 However, the controllers expect the template_id and template_part_id to
 always follow the format theme_name//<template(_part)_name. In practice,
 it's not possible to retrieve a template or template part using only their
 template name (i.e., post_name). The get_block_template() function,
 employed by both REST controllers, presumes that the ID is divided into
 two parts separated by //. The theme's name must always be included in the
 request alongside the template (part) name.

 >**Should we adjust the regex expressions for the REST routes to
 consistently expect the presence of the theme_name?**

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


More information about the wp-trac mailing list