4

I'm reading through the WordPress core and noticed that the update_core transient is fetched with get_site_transient().

What is the difference between get_site_transient() and get_transient()?

If I had seen this somewhere else, I'd have thought: "well... this is to get a transient for a specific site in multisite."

But if this is used for update_core, that thought does not make sense, since the core is one ond only one, even in a multisite.

Did I read the official documentation?

Of course, but it doesn't really clarify it.

1 Answer 1

6

get_site_transient() uses the older nomenclature for multisite which referred to a multisite network as a "site" and individual sites on the network as "blogs". So get_site_transient() is getting the value of a transient for the whole network, while get_transient() gets a transient for an individual site/blog.

If you look at the source of the function you'll see that it uses get_site_option() internally, and the documentation for that function reads (emphasis mine):

Retrieve an option value for the current network based on name of option.

Also note that get_site_option() has been effectively replaced with get_network_option(), but for some reason the same change hasn't been made for the transient function.

1
  • Thanks Jacob, makes sense. Commented Jul 24, 2022 at 9:39

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.