Function: wp_switch_roles_and_user

wp_switch_roles_and_user( integer $new_site_id, integer $old_site_id )

Switches the initialized roles and current user capabilities to another site.

Parameters

Name Type(s) Default Value Description
$new_site_id integer

New site ID.

$old_site_id integer

Old site ID.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.