Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create category on WPMS blog from another blog in the same network.
// current blog
$switch_from = get_current_blog_id();
// blog id we are switching to so we can create a category there
$switch_to = 2;
echo 'About to switch to '.$switch_to.' from '. $switch_from.'.';
switch_to_blog( $switch_to );
echo 'You switched from blog ' . $switch_from . ' to '.$switch_to;
'monkeys', // the term
'category', // the taxonomy
'description'=> 'Very fond of bananas.',
'slug' => 'monkeys'
echo 'You switched back to '.get_current_blog_id().'.';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.