Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help me debug this script please


  • Charles
    Participant

    @charlesrodmell

    I have a snippet I use to redirect people from the homepage to a dashboard page if they are already logged in. However, something weird happens when I (the admin user) try to create a new buddypress group (pressing “add new” on the Groups page) – the snippet fires and sends me to the dashboard page. If I turn off the snippet, the group creation page appears as normal. It’s unrelated to theme – it does it with any theme. Any ideas what happens that I also need to exclude? Cheers


    function myld_loggedin_redirect()
    { if ( is_user_logged_in() && is_front_page() && ! wp_doing_ajax() ) {
    wp_redirect(‘/launchpad/’);
    exit;
    }
    }
    add_action(‘wp’, ‘myld_loggedin_redirect’);

  • You must be logged in to reply to this topic.
Skip to toolbar