[wp-trac] [WordPress Trac] #21676: Pass a variable to get_template_part()

WordPress Trac noreply at wordpress.org
Wed Jul 1 15:42:03 UTC 2020


#21676: Pass a variable to get_template_part()
-------------------------------------+------------------------------
 Reporter:  sc0ttkclark              |       Owner:  SergeyBiryukov
     Type:  enhancement              |      Status:  reviewing
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Template                 |     Version:  3.4.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------------

Comment (by apedog):

 >The problem with extracting the vars is you risk nuking global variables
 and causing breakage elsewhere. If I pass in a parameter called $post for
 example, that would cause problems with any loop further down the page.
 Understood.
 In that case global variables should take precedence/be protected over
 extracted args, and passed parameter variables should take precedence over
 query_vars.

 How does core handle this if a custom query_var is added that is also a
 global variable name?

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


More information about the wp-trac mailing list