Where does WordPress default SimplePie save cache data? I could only find relevant info about cache durations but not the location. SimplePie has a method called set_cache_location() but I cannot find it being used in WordPress.

I'm writing a plugin and if a cache folder is available already by default, I'd like to use it rather than creating for my plugin.

Does anybody know it?


In WordPress, the WP_Feed_Cache class uses the WP_Feed_Cache_Transient class to store the results into a transient.

So, short answer, either in the database or in the Object Cache if you have a persistent object cache stored.

If you need to cache something for a period of time, use a transient.


| improve this answer | |
  • Thanks for the info. I looked into the source in feed.php and there are lines $feed->set_cache_class('WP_Feed_Cache'); $feed->set_file_class('WP_SimplePie_File'); It looks these are the ones setting a transient. I have a custom class which extends SimplePie which WordPress includes. In that case, can I just use these methods and simply pass the words, WP_Feed_Cache and WP_SimplePie_File? – Teno Aug 30 '12 at 18:30
  • You should use set_transient described in the link above. – Wyck Aug 30 '12 at 18:49
  • Do you mean I should use set_transient() separately from SimplePie? Or are you suggesting that I should implement the function into the custom extended class? – Teno Aug 30 '12 at 18:57
  • As I test with my custom class extending the default WordPress SimplePie class, in addition to the above methods, set_cache_class('WP_Feed_Cache') and set_file_class('WP_SimplePie_File'), set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', $cacheduration, $url)) works fine without errors. – Teno Aug 30 '12 at 19:23
  • If you're using it in your plugin, you do want to use set_cache_class() and set_file_class() there, not set_transient – Ryan McCue Aug 31 '12 at 1:26

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.