The MU forums have moved to WordPress.org

how to switch to another site in php? (2 posts)

  1. fleshins
    Member
    Posted 14 years ago #

    What's the "right" way to switch to another site in php? I want to update_option of a different site than the one I'm on (than the one that $current_site points to) and the only way I've found to do it is to modify $wpdb to "point" to the target site's option's table.

    $wpdb->option = "wp_12_options";

    Is there a "better" way to update the options of a site that's not the current one?

  2. fleshins
    Member
    Posted 14 years ago #

    actually, my question is more around the activation of buddypress and how to do it for a different site than the one you're one, will create a new topic ..

    the best way to update the options of a different blog is to switch to it using:
    switch_to_blog( $blog_id );
    then update_option
    then restore_current_blog();

About this Topic

  • Started 14 years ago by fleshins
  • Latest reply from fleshins