Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re-direct logged in users from bbpress home landing to forum category


  • David
    Participant

    @david2019

    Hi All,

    Is there a way to re-direct users that are logged in and land on the bbpress home location e.g /chat/ and re-direct them to a specific forum.

    E.g, logged in users visits mysite.com/chat, and it redirects them to mysite.com/chat/forum/support.

    i am using the code below found in the bbpress forums which re-directs guest to another page. It works great.

    /**
    * Redirect bbPress pages to registration page
    */
    function kleo_page_template_redirect()
    {
        //if not logged in and on a bp page except registration or activation
        if( ! is_user_logged_in() && is_bbpress() ) {
            wp_redirect( home_url( '/register/' ) );
            exit();
        }
    }
    add_action( 'template_redirect', 'kleo_page_template_redirect' );
  • You must be logged in to reply to this topic.
Skip to toolbar