Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: login_redirect

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
424      } else {
425           $redirect_to = admin_url();
426      }
427
428      if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
429           $secure_cookie = false;
430
431      $user = wp_signon('', $secure_cookie);
432
433      $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
434
435      if ( !is_wp_error($user) ) {
436           // If the user can't edit posts, send them to their profile.
437           if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
438                $redirect_to = admin_url('profile.php');
439           wp_safe_redirect($redirect_to);
440           exit();
441      }
442