Support » Plugin: HubSpot Tracking Code for WordPress » update_option DOES work for multisite

  • Just an FYI, you have this bit of code in your plugin:

    // this is a hack because multisite doesn't recognize local options using either update_option or update_site_option...
    if ( is_multisite() )
    	global $wpdb;
    	$multisite_prefix = ( is_multisite() ? $wpdb->prefix : '' );
    	$q = $wpdb->prepare("
    		INSERT INTO " . $multisite_prefix . "options
    	        ( option_name, option_value )
    	    VALUES ('hs_settings', %s)", serialize($opt));
    	update_option('hs_settings', $opt);

    This is completely unnecessary. update_option() works regardless of whether this it is a single site installation or a multisite installation.

    update_option() = Option for individual site. Works on single site, or multisite. Only sets the option for the individual site within the network that it is called from.

    update_site_option() = Option for entire network. Applies to all sites within the network it is called from. It’s just a wrapper for the newer update_network_option() function

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘update_option DOES work for multisite’ is closed to new replies.