[wp-trac] [WordPress Trac] #14019: Introduce get_id_by_name()

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 15 16:40:15 UTC 2010


#14019: Introduce get_id_by_name()
-------------------------+--------------------------------------------------
 Reporter:  filosofo     |       Owner:  filosofo 
     Type:  enhancement  |      Status:  accepted 
 Priority:  normal       |   Milestone:  3.1      
Component:  Template     |     Version:  3.0      
 Severity:  normal       |    Keywords:  has-patch
-------------------------+--------------------------------------------------

Comment(by filosofo):

 Replying to [comment:4 Utkarsh]:
 > I would suggest implementing a `get_post_by` (#12726) instead of this.

 That would not address the problem, which is that you have to go through a
 couple of steps to get the desired post's ID.  As the original example
 demonstrates, what we can't currently do is something like this:

 {{{
 // custom field for post titled "My Day at the Beach"
 echo get_post_meta( get_id_by_name( 'my-day-at-the-beach' ), 'photos-url',
 true );
 }}}

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


More information about the wp-trac mailing list