Make WordPress Core

Changeset 58096


Ignore:
Timestamp:
05/04/2024 07:09:57 PM (3 weeks ago)
Author:
SergeyBiryukov
Message:

Feeds: Add an optional $post parameter to get_the_title_rss().

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed.php

    r56180 r58096  
    151151 *
    152152 * @since 2.0.0
    153  *
     153 * @since 6.6.0 Added the `$post` parameter.
     154 *
     155 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
    154156 * @return string Current post title.
    155157 */
    156 function get_the_title_rss() {
    157     $title = get_the_title();
     158function get_the_title_rss( $post = 0 ) {
     159    $title = get_the_title( $post );
    158160
    159161    /**
Note: See TracChangeset for help on using the changeset viewer.