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

WordPress Trac noreply at wordpress.org
Mon Jun 8 23:30:12 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):

 I'm all for moving this forward. A third parameter for
 variables/args/props seems workable to me. I'm not a fan of hack-ish
 workarounds.

 ----

 ps. no need for {{{get_query_var()}}}. Query vars are extracted in
 {{{load_template()}}} right before the require:
 {{{
 extract( $wp_query->query_vars, EXTR_SKIP );
 }}}
 So {{{set_query_var()}}} seems the cleanest workaround while this gets
 fixed (or moved back to wontfix land). Thought I'd mention it in this
 ticket.

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


More information about the wp-trac mailing list