0

When a user signs up they create a blog. I want to let them set an option that is specific to that blog. When they save that option should I use update_option(), update_user_option(), update_blog_option() or update_site_option()? I know update_site_option() is out because that is for setting an option across a network. The rest are somewhat ambiguous.

update_blog_option seems appropriate but then why is there a update_user_option? And is update_option updating for the user logged in or is that also network wide?

Update:
After some more research, it looks like update_user_option() is the most appropriate call.

Quote from that page:

When multisite is installed, the $global parameter can be used to set the user option for the whole network, instead of just the current site.

Example setting global value (across all network):

update_user_option( $user_id, 'key', $value, true );

Thus, this call will save the option for the current site of the user. That's what I want. But they said current site. If the user can have more than one blog then update_blog_option() may be more appropriate. So the question is, can a user have more than one blog on a network site?

0

Answer is update_blog_option(). This is specific for each blog. If I used get_user_option() it would be different for each user. If I used get_site_option() it would be across all sites on the network.

| improve this answer | |

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.