• Resolved Harm10

    (@harm10)


    I have several php scripts running on my sites that detect what type of web page is shown (or what loop is in use).
    When the Maintenance page is displayed the wp_query is empty and is_login() (new since WP 6.1) is not set.
    Is there a way I can detect that the Maintenance page is displayed?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Stefan Cotitosu

    (@stefancotitosu)

    Hi @harm10,

    Thank you for using LightStart. The following code can be used to check if the maintenance mode is enabled in the plugin:

    $maintenance_mode = get_option('wpmm_settings');
    if (!empty($maintenance_mode['general']['status']) && $maintenance_mode['general']['status'] == '1') {
    echo "Maintenance mode is active.";
    }

    I hope this will help.

    Thread Starter Harm10

    (@harm10)

    @stefancotitosu Thank your for your code. But I want to know when the maintenance page is displayed to a visitor. That is different from knowing the plugin is active. Is this possible to deduce from the global $wp_query and/or $GLOBALS[‘pagenow’]?

    Plugin Support rodicaelena

    (@rodicaelena)

    Hi,

    Unfortunately, I don’t think that is possible.

    Thank you!

    Thread Starter Harm10

    (@harm10)

    @rodicaelena I think that is a rather unbelievable answer. How does the plugin conclude that it should show the maintenance page?

    Plugin Support Kush

    (@kushnamdev)

    The plugin determines when to show the maintenance page by hooking into WordPress’s request flow and checking whether maintenance mode is enabled, the user is not logged in or excluded, and the request is for a frontend page.

    If all those conditions are met, it serves the maintenance page directly. It doesn’t rely on WordPress’s default maintenance logic — it handles this entirely on its own.

    Best regards,

    Thread Starter Harm10

    (@harm10)

    @kushnamdev OK let’s agree to disagree ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.