#14804 closed enhancement (duplicate)
Allow the_title_attribute() to accept a post ID
Reported by: | coffee2code | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
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.
Attachments (2)
Change History (6)
Note: See
TracTickets for help on using
tickets.
Patch mentioned in ticket.