[wp-trac] [WordPress Trac] #36631: wp.template() should throw an error if the template is not found

WordPress Trac noreply at wordpress.org
Tue Sep 20 03:50:55 UTC 2022


#36631: wp.template() should throw an error if the template is not found
-------------------------------------+-------------------------
 Reporter:  joehoyle                 |       Owner:  desrosj
     Type:  enhancement              |      Status:  closed
 Priority:  normal                   |   Milestone:  6.1
Component:  General                  |     Version:
 Severity:  normal                   |  Resolution:  fixed
 Keywords:  has-patch needs-testing  |     Focuses:  javascript
-------------------------------------+-------------------------
Changes (by desrosj):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54241" 54241]:
 {{{
 #!CommitTicketReference repository="" revision="54241"
 General: Throw a more descriptive error when templates are not found.

 When `wp.template()` is called in JavaScript for a template element that
 does not exist, a very nondescript error message is currently returned
 (“Uncaught TypeError: Cannot read property `replace` of `undefined`”).

 This updates adds a check for this scenario and a new “Template not found”
 error is now thrown instead.

 Props joehoyle, noisysocks, hilayt24.
 Fixes #36631.
 }}}

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


More information about the wp-trac mailing list