How to bypass Elementor's maintenance mode using the query string
Last updated • 22 August 2019
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;
} );