Redirect to login page, and back again if not logged in (for Beaver Builder)

I've finally decided that today was the day to fix a small annoying problem I had with Beaver Builder that was bugging me for some time. It was just never annoying enough to do anything about it.

I must say, however, in retrospect, it's perhaps more of an indication of my unhealthy relationship with tabbed browsing...

If you get logged out from WordPress when your session expires but click on the 'Page Builder' button from the top WP menu, you go to the page, but Beaver Builder (of course) doesn't open. You then have to go around the houses to log in, before coming back to your page that you want to edit.

Here's a video that takes 5 minutes to watch, but doesn't say any more than the above paragraph:

These 3 lines of code put an end to months of being very occasionally, very mildly frustrated with this 🙂 I hope it helps someone else too. Pop in your functions.php file.

                            
if ( ! is_user_logged_in() && isset( $_GET[ 'fl_builder' ] ) ) {
auth_redirect();
}
            
        

2 Comments

  1. Quasel on 11th March 2017 at 6:17 pm

    Looks like something that should be implemented by default 😉 but maybe there are reasons I can’t see ^^

    • Doug on 11th March 2017 at 6:39 pm

      Yeah… I might see what Justin Busa thinks and see if there’s a reason. If not I might submit a PR.

Leave a Comment