Saturday 26 June 2010

Wordpress RSS MAGPIE Cache Change Update Frequency

(Wordpress 8 and up, older version look at thirstyofmind)
If you want to use the rssparser from wordpress and want this parser to always update, here's the procedure to follow:

In the folder wp-includes, edit the file rss.php:

1 look for RSS feed constant and update Magpie User Agent as below:
define('MAGPIE_USER_AGENT', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 GTB5');

2 look for function fetch_rss ($url) and update:
function fetch_rss ($url, $NoCache = false)

3 quite close to fetch rss look for ( MAGPIE_CACHE_ON ) { and change with:
if ( MAGPIE_CACHE_ON | $NoCache) {

4 now if you call teh fetching function like this: fetch_rss ($url, true) , the cache will be turned off and you'll have the latest items from the updated feed

5 look for class RSSCache
and change $Max AGe to something lower (12 hours = 43200 secsonds by default, thats too much)
for my part i updated to $MAX_AGE = 10;
:)

No comments:

Post a Comment