Sync Taxonomies programmatically

If you have the Sync Taxonomies add-on installed, you can use PHP code to sync taxonomies programmatically.

if ( function_exists( 'broadcast_sync_taxonomies' ) )
{
	// Before you start, you're on the source blog, right?
	// This is the name of the post type the taxonomy belongs to.
	$post_type = 'post';
	// This is the taxonomy name beloning to the post type above.
	$taxonomy = 'category';
	// An array of blog IDs to which to sync the chosen taxonomy.
	$blogs = [ 5, 20, 400 ];
	broadcast_sync_taxonomies()->sync_taxonomy( $post_type, $taxonomy, $blogs );
}