How to bypass Elementor’s maintenance mode using the query string

I recently found myself in a situation where I needed to test the non-logged in user experience while Elementor’s maintenance mode was enabled.

The quick and easy solution I came up with was to override the option Elementor uses to enable maintenance mode when the query string contained a parameter of my choosing.

Using the snippet below, I’m able to bypass the maintenance mode by appending ?bypass_maintenance=1 to the query string.

e.g; https://somesite.com/some/page/?bypass_maintenance=1

<?php
add_filter( 'pre_option_elementor_maintenance_mode_mode', function ( $option ) {
$parameter = 'bypass_maintenance'; // change this to whatever you like
if ( isset( $_GET['bypass_maintenance'] ) and $_GET['bypass_maintenance'] ) {
return 0; // needs to be falsy but not FALSE
}
return $option;
} );

Need a website? Let's talk.

From website design & SEO through to custom WordPress plugin development. I transform ideas into dynamic, engaging, and high-performing solutions.
Subscribe to get the latest insights & updates in the world of web and how it impacts your business and website.
© 2024 Phil Kurth  |  All rights reserved.