In the default wordpress rss feed the element <pubDate> is

<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>

and gives a result of <pubDate>Tue, 12 May 2020 12:39:03 +0000</pubDate>

how can i change this line to give a result of <pubDate>12/05/2020 12:39:03 +0000</pubDate> (d/m/Y) or <pubDate>12-05-2020 12:39:03 +0000</pubDate> (d-m-Y) but to be valid with RFC-822 ?

I tried many variations <pubDate><?php echo mysql2date('r', get_the_time('Y-m-d H:i:s')); ?></pubDate> or <pubDate><?php echo get_post_time( 'd/m/Y H:i:s O', true ); ?></pubDate> but they dont validate.

Any ideas would be appreciated.


You can probably do this by customizing the feed:


This way you can make your own template for a feed, and alter the pubDate to your needs.

| improve this answer | |
  • I already created my own template for a feed, but i can't change the format of the date to be valid. Any ideas on this? – Honoluluman Jun 10 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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