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
460      } else {
461           $redirect_to = admin_url();
462      }
463
464      if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
465           $secure_cookie = false;
466
467      $user = wp_signon('', $secure_cookie);
468
469      $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
470
471      if ( !is_wp_error($user) ) {
472           // If the user can't edit posts, send them to their profile.
473           if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
474                $redirect_to = admin_url('profile.php');
475           wp_safe_redirect($redirect_to);
476           exit();
477      }
478