Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Redirect user to dashboard after logged in
- */
- add_filter( 'login_redirect', function( $redirect_to, $requested_redirect_to, $user ){
- if( ! is_wp_error( $user ) && $user instanceof WP_User ){
- $user_url = get_author_posts_url( $user->ID );
- if( get_option( 'permalink_structure' ) ){
- return trailingslashit( $user_url ) . 'dashboard';
- }
- return add_query_arg( array(
- 'dashboard' => '1'
- ), $user_url );
- }
- return $redirect_to;
- }, 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement