I have a third party tool which extracts feed content from our WordPress site, via our RSS feed: http://ontariotravelblog.com/feed

The feed provides me with everything I need, except for the last updated date of the blog post; it does include the published date, however this is simply the date the blog was first published; edits / changes made to the blog after publication does not affect this date.

Now what's interesting is that the ATOM version of the feed (http://ontariotravelblog.com/feed/atom) does include both the published date and the updated date, for example:

    <title type="html">
        <![CDATA[8 Songs for Your Ontario Summer Road Trip Playlist]]>

Which is great, except that the ATOM feed is missing some critical content (in particular, its missing a number of "media:" elements, such as media:thumbnail, etc.)

So after all this, my question: Is there a way to get the updated field which is included within the ATOM feed entry to appear on the main RSS feed? (perhaps via some config option?)

1 Answer 1


Atom vs RSS2

Let's look at the wp-includes/feed-atom.php and wp-includes/feed-rss2.php files.

The updated element of the Atom feed entry is:

    echo mysql2date(

The pubDate element of the RSS2 feed item is:

    echo mysql2date(
        'D, d M Y H:i:s +0000', 
        get_post_time('Y-m-d H:i:s', true), 

The lastBuildDate element of the RSS2 channel is:

    echo mysql2date(
        'D, d M Y H:i:s +0000', 


The RSS2 feed already contains the Atom namespace:


so I think we can use the <atom:updated> element for our custom updated element. You might want to check it out further, if that fulfills the standard or if there are other possible namespaces suitable for this.

For the latter case we can use the rss2_ns action to add the relevant namespace.

Inject a custom element

We can use the rss2_item action to inject custom item elements, like:

add_action( 'rss2_item', function()
         get_post_modified_time( 'D, d M Y H:i:s +0000', true )

} );

Hopefully you can adjust it to your needs.

  • Absolutely wonderful answer - with great detail. Unfortunately I just found out that you can't actually modify these files on sites hosted on WordPress.com - only on self hosted sites. I had hoped there would be a config setting somewhere which would allow this, but after chatting with WP.COM support staff, apparently not. In any case, I'm going to mark this as the correct answer as it sure sounds like it would work great, I just can't verify it myself since this is not a self hosted site.
    – RMD
    Commented Jun 15, 2016 at 14:38
  • Maybe you could join the atom+rss2 feeds with some external service or application (custom) or setup your own WordPress install ;-) @RMD
    – birgire
    Commented Jun 15, 2016 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.