Download

Documentation

Print This page

Automatic redirect to Analytify dashboard when users log in

You would need to add following code in your theme's functions.php

 

function analytify_dashboard_redirect( $redirect_to, $request, $user  ) {

  if ( ! is_wp_error( $user ) ) {

   return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url( 'admin.php?page=analytify-dashboard' ) : $redirect_to;

  }

}

add_filter( 'login_redirect', 'analytify_dashboard_redirect', 10, 3 );