I'm trying to understand the difference between get_site_option() and get_blog_option().

Are blog and site two different things? Apologies if this question seems basic, but when referring to a WordPress website, I've always used both terms very loosely (to mean the same thing). I'm now wondering if there is a difference?

3 Answers 3


get_option() returns an option for the current blog.

In single site installation, the current blog is the only blog. So get get_option() returns the option for it.

get_site_option() is used to retrieve an option network-wide. It means that you can get the same option from any site of the network.

When this function is used in single installation, it normally returns the same thing of get_option(). The value may change because get_site_option() trigger filter hooks that are not triggered by get_option().

Note that once the $wpdb->options table is blog-specific, network-wide options are stored in the $wpdb->sitemeta table, that is specific of multisite installations.

get_blog_option() is the only among the three functions that doesn't receive the option name as 1st argument, but its 1st argument is $blog_id.

In fact, it is used in multisite installations to retrieve an option from a specific blog whose the id is known.

What this function does is:

switch_to_blog( $blog_id );
$value = get_option( $option, $default );

return $value;

If $blog_id is the same of current blog id, WordPress just skips the switch_to_blog part and just calls get_option().

This function is defined in the file wp-includes/ms-blogs.php that is loaded only for multisite installation, so get_blog_option() is not defined in single site installations.


get_site_option() - Gets a network wide option. This option is usually added in the Network Admin Settings section of a multisite set-up. If I had 50 sites, it would be a pain to go to 50 different sites and set the same option value. Instead I could set the option value once and have it apply across the network for all sites. See http://codex.wordpress.org/Function_Reference/get_site_option

get_blog_option() - Lets you get the value of an option for a specific site. One example might be to get the value of a user specific option for each site. So I could get all of the sites that the user belongs too, loop over the list of site IDs, and use get_blog_option() passing the blog_id and option name and get back the result. It's a convenience function that pretty much does the following:

switch_to_blog( $id ); $value = get_option( $option_name ); restore_current_blog();

See http://codex.wordpress.org/Function_Reference/get_blog_option

tl;dr: get_site_option() gets a network wide value, get_blog_option() gets a specific value for a given site without needing to switch to that site first on your own.


Although get_option() may retrieve the blog option on network sites, sometimes the network filters override the site option.

For example: users_can_register for the site will always be overridden by the network setting.

To retrieve the site option, sometimes you'll need to remove any network filters which are located in the ms-default-filters.php file in the WP Core.

remove_filter( 'option_users_can_register', 'users_can_register_signup_filter' ); // ignore network override
$registration = get_option( 'users_can_register');

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.