Redirect after Login on WordPress

后端 未结 13 3026
我寻月下人不归
我寻月下人不归 2020-12-04 11:26

I\'m creating a customized WordPress theme based on an existing site.

I want to use an alternate dashboard which I have created.

How can I have the user dire

13条回答
  •  清歌不尽
    2020-12-04 12:09

    // add the code to your theme function.php
    //for logout redirection
    add_action('wp_logout','auto_redirect_after_logout');
    function auto_redirect_after_logout(){
    wp_redirect( home_url() );
    exit();
    }
    //for login redirection
    add_action('wp_login','auto_redirect_after_login');
    function auto_redirect_after_login(){
    wp_redirect( home_url() );
    exit();
    `enter code here`}
    

提交回复
热议问题