Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can except admins from this login redirect code

  • Profile photo of tednopple
    tednopple
    Participant

    @tednopple

    I want to redirect logged in users to the homepage instead of the backend defualt. I am using this code below, but it also does it for the admin. How can make an exception for admin

    if( !function_exists( 'themeprefix_user_login_redirect' ) ) {
    		function themeprefix_user_login_redirect() {
    			$redirect_to = 'http://www.mywebsite.com'; //add redirect URL here
    			return $redirect_to;
    			}
    	add_filter( 'login_redirect','themeprefix_user_login_redirect',10,3 );
    }
  • The topic ‘How can except admins from this login redirect code’ is closed to new replies.