I understand that Transients API is used to cache data and should be intended to store data that is expected to expire.

However, please clarify the following.

Can set_transient() be used to store data in multi-site scenario? If yes, how is it different from using set_site_transient() function?

1 Answer 1


As the Codex suggests:

Essentially the same as set_transient() but works network wide when using WP Multisite.

One difference is that the transient name should be 40 characters or less in length. Also, while set_transient() sets transients that have an expiration time to not autoload, all transients added with set_site_transient will auto-load at all times.

In other words, the fundamental difference is in the auto-loading and since transients might be serialized, you could risk breaking things if referring to a blog (in MU) which has different settings/url/etc.

So the short answer is:

  • use set_transient for single blogs

  • use set_site_transient when you need something for ALL blogs.

Example of stored transients:

enter image description here

  • From your answer, I understand the following. 1. We can use set_transient for multisite 2. If we have blog specific data to be stored in cache, then it is better to use set_site_transient. Could you let me know if I get it right? Aug 29, 2016 at 15:57
  • 2
    1. Yes, you can use it with WP MU. 2. If for blog you mean the whole WP Multisite, then yes. set_site_transient is meant to work on a more global level, while set_transient on a single blog level.
    – The J
    Aug 29, 2016 at 16:01

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.