[wp-trac] [WordPress Trac] #24714: get_template_part : !empty instead of isset ?

WordPress Trac noreply at wordpress.org
Tue Jul 9 03:11:57 UTC 2013


#24714: get_template_part : !empty instead of isset ?
--------------------------+-----------------------------
 Reporter:  tivnet        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 With a call like this one:
 {{{
 get_template_part( 'content', get_post_format() );
 }}}
 `get_post_format()` may return `false`, and then the following  condition
 does not do what it should:
 {{{
         if ( isset($name) )
                 $templates[] = "{$slug}-{$name}.php";
 }}}
 and tries to load `content-.php`
 Using `!empty` instead of `isset` should work better.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24714>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list