Troubleshooting & How-Tos 📡 🔍 Web Development

Make Feedly Notice an Updated WordPress Post by Changing the GUID

Sometimes it’s better to update an existing blog post than to write a new one. Maybe there’s an ongoing conversation in the comments thread, or news is breaking over the course of a day. Sometimes I’ll post a poll, then reuse the same post for the results, to keep discussion together. The problem is that not everyone will get the notice that the article has changed.

New GUID = New Stuff to Read

After posting a question on Feedly’s Google+ page, I confirmed that Feedly (and no doubt other readers) uses the post GUID to decide whether to fetch content. If it’s seen the GUID before, it assumes it’s already seen the content, and stops looking at it.

If you’ve never delved into RSS markup, you’ve probably never noticed this field, but the GUID is a “generally unique identifier” used to tell feed readers whether they’ve seen an article before. A new GUID means a new post. Most of the time, you don’t want that to happen, because you don’t want it adding the same post over and over again every time you fix a typo or change a headline.

Under limited circumstances, though, it might make sense to tell reader software that the updated post is a new one.

How to do it in WordPress

A StackExchange post pointed me to a filter hook that can be used to change the GUID. WordPress uses the ID-style permalink by default, because it should be unique, but it’s important to remember that the field is only an ID, and isn’t used as a link — so you can modify it without worrying about it staying a valid URL.

The response suggested to just append the modification date, but I didn’t want to do that. I frequently update old posts to fix typos, update links, remove dead links, etc. So instead, I added a custom field that I can fill out when I make a big enough change that I want the post to show up as new again.

Code!

// Modify the GUID in the RSS feed after major revisions (but not after every
// little change) so that clients like Feedly will pull the updated content.
function ktv_feed_guid_revisions($content) {
	$revised = get_post_meta( get_the_ID(), 'updated', true );
	if ($revised != "") {
		$content .= "?updated=$revised";
	}
	return $content;
}
add_filter('get_the_guid', 'ktv_feed_guid_revisions', 7);

I’ve got it in a functionality plugin for now. When I make a change that I really want to update everywhere, I add a custom field called “updated” and give it a value – usually a number, so that I can add to it if I have something that I update more than once while it’s still new enough to show up in feeds.