Make WordPress Core


Ignore:
Timestamp:
10/24/2025 03:30:35 AM (3 months ago)
Author:
westonruter
Message:

General: Improve resilience of feed_links_extra() when global $post is not set.

This obtains the global post via get_queried_object() when is_singular().

Developed in https://github.com/WordPress/wordpress-develop/pull/10401

Props westonruter, johnjamesjacoby, Presskopp, abcd95, dilipbheda, sabernhardt, awetz583, indirabiswas27.
Fixes #63263.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/general/feedLinksExtra.php

    r58097 r61056  
    635635        );
    636636    }
     637
     638    /**
     639     * @ticket 63263
     640     */
     641    public function test_feed_links_extra_should_work_fail_if_global_post_empty() {
     642        $post_id = self::factory()->post->create();
     643        $this->go_to( get_permalink( $post_id ) );
     644        $GLOBALS['post'] = null;
     645
     646        $this->assertNotEmpty( get_echo( 'feed_links_extra' ) );
     647    }
    637648}
Note: See TracChangeset for help on using the changeset viewer.