This snippet will delete specified taxonomy terms from the child blogs during broadcasting.
/**
@brief Deletes the specified taxonomy terms on the child blog during broadcasting.
@since 2020-12-04 16:32:47
**/
function bc_threewp_broadcast_broadcasting_before_restore_current_blog( $action )
{
// Start of config.
$terms_to_remove = [
'category' => [ // Taxonomy type
'category123', // Term slug
'anothercategory', // Term slug
],
];
// End of config.
foreach( $terms_to_remove as $taxonomy => $terms )
foreach( $terms as $term )
{
// We have to first get the term ID
ThreeWP_Broadcast()->debug( 'Looking for %s term %s', $taxonomy, $term );
$term_data = get_term_by( 'slug', $term, $taxonomy );
if ( ! $term_data )
continue;
ThreeWP_Broadcast()->debug( 'Deleting term %s (%s)', $term, $term_data->term_id );
wp_delete_term( $term_data->term_id, $taxonomy );
}
}
add_action( 'threewp_broadcast_broadcasting_before_restore_current_blog', 'bc_threewp_broadcast_broadcasting_before_restore_current_blog' );