Support

Account

Home Forums Feature Requests Support Multisite options for all sites through sitemeta table Reply To: Support Multisite options for all sites through sitemeta table

  • I have managed to accomplish network-level settings with some filters:

    
    // When loading the value for the "Foo" field, get it from the sitemeta table:
    add_filter( "acf/load_value/key=foo", function () use ( $field_key ) {
    	$value = get_site_option( $field_key );
    
    	if ( $value !== false ) {
    		return $value;
    	}
    
    	return '';
    } );
    
    // When setting the value for the "Foo" field, set it to sitemeta table:
    add_filter( "acf/update_value/key=foo", function ( $value ) use ( $field_key ) {
    	return add_site_option( $field_key, $value );
    } );
    

    Result: Updating the field “Foo” in any of the network sites applies it to all of the network sites.

    It’s up to the developer, though, to make sure that these fields are assigned to an Options page which has the super-admin permission callback.