Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 11 years ago

#14804 closed enhancement (duplicate)

Allow the_title_attribute() to accept a post ID

Reported by: coffee2code's profile coffee2code Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:


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)

14804.diff (840 bytes) - added by coffee2code 14 years ago.
Patch mentioned in ticket.
14804.2.diff (1.2 KB) - added by coffee2code 12 years ago.
Refresh patch to apply cleanly against trunk.

Download all attachments as: .zip

Change History (6)

14 years ago

Patch mentioned in ticket.

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to Future Release

12 years ago

Refresh patch to apply cleanly against trunk.

#2 @Jayjdk
11 years ago

[24783] allows the_title_attribute() to receive a post argument.

Last edited 11 years ago by Jayjdk (previous) (diff)

#3 @Jayjdk
11 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #24232.

#4 @helen
11 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.