#61139 closed enhancement (fixed)
Add an optional $post parameter to get_the_title_rss() the same way get_the_title() works
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Feeds | Keywords: | good-first-bug has-patch |
Focuses: | Cc: |
Description
This will allow it to be used outside of the loop and ensure consistency:
function get_the_title_rss( $post = 0 ) { $title = get_the_title( $post ); /** * Filters the post title for use in a feed. * * @since 1.2.0 * * @param string $title The current post title. */ return apply_filters( 'the_title_rss', $title ); }
Use case: I'm adding related posts to a feed item and I only need the title, link and thumbnail, so there's no need to setup global $post and then reset it.
Change History (4)
#1
@
9 months ago
- Keywords needs-patch good-first-bug added
- Milestone changed from Awaiting Review to 6.6
This ticket was mentioned in PR #6501 on WordPress/wordpress-develop by @khokansardar.
9 months ago
#2
- Keywords has-patch added; needs-patch removed
#3
@
9 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 58096:
@SergeyBiryukov commented on PR #6501:
9 months ago
#4
Thanks for the PR! Merged in r58096.
Note: See
TracTickets for help on using
tickets.
Trac ticket: #61139