Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_switch_roles_and_user ›

Da4.9.0
Deprecaton/a
wp_switch_roles_and_user ( $new_site_id, $old_site_id )
Parametri: (2)
  • (int) $new_site_id New site ID.
    Richiesto:
  • (int) $old_site_id Old site ID.
    Richiesto:
Definito a:
Codex:

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



Sorgenti

function wp_switch_roles_and_user( $new_site_id, $old_site_id ) {
	if ( $new_site_id == $old_site_id ) {
		return;
	}

	if ( ! did_action( 'init' ) ) {
		return;
	}

	wp_roles()->for_site( $new_site_id );
	wp_get_current_user()->for_site( $new_site_id );
}