Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Quirk redirect after login

Discussion in 'Misc WordPress Requests' started by fibbo8, Jan 16, 2018.

  1. fibbo8


    Reply To: Quirk redirect after login, by fibbo8

    Hy Belly,

    thanks again for your reply. You’ve been helpful.
    I’m not a developer and I’ve got to arrive to some results with many tries, but now it seems that redirects work like I’ve expected.

    I’ve follow the cue of your linked post, but made a little change.

    In my case the redirect worked if I defined the “href” omitting the $_SERVER[“HTTP_HOST”] paramater:

    <a href="<?php echo wp_login_url($_SERVER['REQUEST_URI'] ); ?>"

    To maintain the redirect on backend dashboard for the admin I’ve put this function in function.php:

    function my_login_redirect( $url, $request, $user ){
    if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
    if( $user->has_cap( 'administrator' ) ) {
    $url = admin_url();
    return $url;
    add_filter('login_redirect', 'my_login_redirect', 10, 3 );

    Reply To: Quirk redirect after login

Share This Page

Monarch Social Sharing Plugin