As the title of this post says i need to create a registration form to let readers register to my site and access to special contents not visible to everybody.

Is there some plugin that handles this features? I've tryed some, but after login they redirect me on wordpress admin back-end.

I do not want to allow people access to website admin page.

Any suggestion?

  • Have you already tried searching redirect on the site? There're plenty example of this. In short: exit( wp_redirect( home_url( '/' ) ) );... One example is my answer here.
    – kaiser
    Oct 8, 2012 at 9:05

1 Answer 1


Paste this into your functions.php file and edit according to comments.

add_filter('login_redirect', 'redirect_user', 10);

function redirect_user(){

    global $user;

    //where you want to redirect users too
    $redirect = home_url() . '/where-do-we-go-from-here/';

    *  each role listed in this array will be redirect to above URL
    *  if you only have one user role to redirect then simply remove
    *  the others.

    $role = array( 



    if ( in_array( $user->roles[0], array( 'administrator') ) ) {

        //admin will go to the dashboard
        return admin_url();

    } elseif ( in_array( $user->roles[0], $role ) ) {

        return $redirect;



I should add that the following,

$redirect = home_url() . '/where-do-we-go-from-here/';
//returns http://www.example.com/where-do-we-go-from-here/

Can also be written as,

$redirect = home_url( '/where-do-we-go-from-here/' );
//returns http://www.example.com/where-do-we-go-from-here/

...where by the function home_url accepts the path as one of its arguments/parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.