[wp-trac] [WordPress Trac] #41152: New Function to Require a file

WordPress Trac noreply at wordpress.org
Tue Apr 14 09:36:34 UTC 2020


#41152: New Function to Require a file
-----------------------------+----------------------
 Reporter:  rinkuyadav999    |       Owner:  (none)
     Type:  feature request  |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Themes           |     Version:
 Severity:  normal           |  Resolution:  wontfix
 Keywords:  close            |     Focuses:
-----------------------------+----------------------
Changes (by SergeyBiryukov):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 Replying to [comment:14 rinkuyadav999]:
 > PS: i am expecting a function like `wp_require_theme_file( '/inc/icon-
 functions.php' );` and it will do `require get_template_directory() .
 '/inc/icon-functions.php';`

 As noted above, this can already be achieved with `get_template_part( 'inc
 /icon-functions' )`, or `locate_template( 'inc/icon-functions.php', true
 )`, though I don't see any significant benefit over `require`.

 I agree this might look a bit weird semantically, as `icon-functions.php`
 is not a template, but it works as expected.

 Given the lack of traction for the last three years, it doesn't look like
 there's a need for yet another function at this time.

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


More information about the wp-trac mailing list