Make WordPress Core


Ignore:
Timestamp:
03/20/2019 08:37:02 PM (6 years ago)
Author:
adamsilverstein
Message:

Feeds: ensure build/update date matches current query.

Displaying the correct build date in feeds is as important today as it was twelve years ago when this ticket was opened.

Fix an issue where all feeds in WordPress showed the same date for their last build date (the datapoint is lastBuildDate, updated or dc:date depending on the feed type).

Introduce a new get_last_build_date filter to adjust the date used for lastBuildDate. Developers who previously filtered get_lastcommentmodified to alter feed dates should use this filter instead.

  • get_last_build_date extracts the latest post (or comment) in the current WP_Query object.
  • In all feed templates, use get_last_build_date vs get_lastpostmodified( 'GMT' );.

Props stevenkword, spacedmonkey, ryanshoover, mauteri, nacin, jorbin, MikeNGarrett, Denis-de-Bernardy, peaceablewhale.
Fixes #4575.

File:
1 edited

Legend:

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

    r43571 r44948  
    3636    <dc:date>
    3737    <?php
    38         $date = get_lastpostmodified( 'GMT' );
     38        $date = get_last_build_date();
    3939        echo $date ? mysql2date( 'Y-m-d\TH:i:s\Z', $date ) : date( 'Y-m-d\TH:i:s\Z' );
    4040    ?>
Note: See TracChangeset for help on using the changeset viewer.