Opened 3 years ago
Last modified 2 years ago
#14804 new enhancement
Allow the_title_attribute() to accept a post ID
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| 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)
Note: See
TracTickets for help on using
tickets.

Patch mentioned in ticket.