WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 9 months ago

Last modified 9 months ago

#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)

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

Download all attachments as: .zip

Change History (6)

coffee2code4 years ago

Patch mentioned in ticket.

comment:1 nacin3 years ago

  • Milestone changed from Awaiting Review to Future Release

coffee2code2 years ago

Refresh patch to apply cleanly against trunk.

comment:2 Jayjdk9 months ago

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

Version 0, edited 9 months ago by Jayjdk (next)

comment:3 Jayjdk9 months ago

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

Duplicate of #24232.

comment:4 helen9 months ago

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