Skip to content

Commit 6bf7b1d

Browse files
Add an inline comment why change made
1 parent fbe72e4 commit 6bf7b1d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/wp-includes/general-template.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3326,6 +3326,10 @@ function feed_links_extra( $args = array() ) {
33263326
*/
33273327
$args = apply_filters( 'feed_links_extra_args', $args );
33283328

3329+
/*
3330+
* Use the queried object rather than relying on the global $post.
3331+
* feed_links_extra() should not depend on $GLOBALS['post'] being set. See #63263
3332+
*/
33293333
$queried_object = get_queried_object();
33303334
if ( is_singular() && $queried_object instanceof WP_Post ) {
33313335
$post = $queried_object;
@@ -3348,6 +3352,10 @@ function feed_links_extra( $args = array() ) {
33483352
*/
33493353
$show_post_comments_feed = apply_filters( 'feed_links_extra_show_post_comments_feed', $show_comments_feed );
33503354

3355+
/*
3356+
* Pass the explicit post to comments_open() / pings_open() and
3357+
* the_title_attribute() to avoid relying on globals.
3358+
*/
33513359
if ( $show_post_comments_feed && ( comments_open( $post ) || pings_open( $post ) || (int) $post->comment_count > 0 ) ) {
33523360
$title = sprintf(
33533361
$args['singletitle'],

0 commit comments

Comments
 (0)