Skip to content

Commit

Permalink
Feeds: Add an optional $post parameter to get_the_title_rss().
Browse files Browse the repository at this point in the history
This allows the function to be used outside of the loop and brings parity with `get_the_title()`.

Follow-up to [1976], [3314], [21735].

Props khokansardar, oglekler.
Fixes #61139.

git-svn-id: https://develop.svn.wordpress.org/trunk@58096 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed May 4, 2024
1 parent 121e5d6 commit 4a25635
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wp-includes/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ function wp_title_rss( $deprecated = '–' ) {
* Retrieves the current post title for the feed.
*
* @since 2.0.0
* @since 6.6.0 Added the `$post` parameter.
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @return string Current post title.
*/
function get_the_title_rss() {
$title = get_the_title();
function get_the_title_rss( $post = 0 ) {
$title = get_the_title( $post );

/**
* Filters the post title for use in a feed.
Expand Down

0 comments on commit 4a25635

Please sign in to comment.