[wp-trac] [WordPress Trac] #17279: No need to run twentyeleven_url_grabber twice

WordPress Trac wp-trac at lists.automattic.com
Thu May 12 18:18:45 UTC 2011


#17279: No need to run twentyeleven_url_grabber twice
--------------------------+------------------
 Reporter:  duck_         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.2
Component:  Themes        |     Version:  3.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------

Comment (by lancewillett):

 Even better is to run it once and use get_permalink() only as a fallback.
 empty() catches the false and an empty string.

 {{{
 $link_url = twentyeleven_url_grabber();
 if ( empty( $link_url ) )
    $link_url = get_permalink();
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17279#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list