[wp-trac] [WordPress Trac] #14804: Allow the_title_attribute() to accept a post ID

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 7 15:41:39 UTC 2010


#14804: Allow the_title_attribute() to accept a post ID
-------------------------+--------------------------------------------------
 Reporter:  coffee2code  |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:                 
 Severity:  normal       |    Keywords:  has-patch      
-------------------------+--------------------------------------------------
 `the_title_attribute()` does not currently accept being passed a post
 object/ID and therefore, via its call to `get_the_title()` without an
 argument, always assumes the current post.  By simply allowing its `$args`
 array to accept and use a "post" value, then the function can be used to
 generate an attribute-friendly post title for any specified post.

 Attached is the patch enabling this.  The `$args` array is amended with a
 "post" element, default of 0 (which maintains current default behavior).
 Since `get_post()`, by way of `get_the_title()`, accepts a post ID or post
 object, either type can be assigned as value for the "post" element.

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


More information about the wp-trac mailing list