Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 928981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:05:51+00:00 2026-05-15T20:05:51+00:00

I have a WordPress driven website and I need to be able to close

  • 0

I have a WordPress driven website and I need to be able to close the site at a moment’s notice. I need some help to work out a way to do that whereby a php script will check a remote file (xml, php, whatever) hosted on another server to check for a variable (ie. website=closed). If variable is present then close the site with a message such as “Website temporarily closed”. Does anyone have any tips on how to go about doing this, or know of any resources I can access.

WordPress knowledge = good / PHP knowledge = beginner

Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:05:51+00:00Added an answer on May 15, 2026 at 8:05 pm

    You could install a maintenance mode plugin, then within that code find the trigger to turn on maintenance mode, then inject a function (curl, for instance) that checks the other site for your variable. For example, if you choose to use the plugin mentioned above, in maintenance-mode.php line 46 checks to see if you’ve turned on maintenance mode:

    if (substr($this->g_opt['mamo_activate'], 0, 2)=='on'){... 
    

    you can add a function to maintenance-mode.php that checks for your variable:

    function check_for_external_var(){
        $crl = curl_init();
        curl_setopt($crl, CURLOPT_URL, "example.com");// set url
        curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);//return page as string
        return curl_exec($crl);//return string
        curl_close($crl);//close curl connection
    }
    

    then assuming your external site returns on for maintenance mode on, and off for maintenance mode off, you can add to the maintenance-mode.php if statement like so:

    if (substr($this->g_opt['mamo_activate'], 0, 2)=='on' || check_for_external_var()=='on'){...
    

    this will check to see if either maintenance mode has been turned on from within the wordpress admin, or your external site; in either case it will activate maintenance mode.


    EDIT:

    Actually the above will not work the way (I think) you are looking for.

    The only reason I can think of to have an external var somewhere shut down your site is so that you can turn off multiple sites at the same time. Is this close?

    If that is the case, it would make more sense to have a script on the external site that does a GET to your WP installs that puts them into maintenance mode. To do it from within the site that runs the WP install, you’d need to run a script that checked the external site ever n seconds. This would create a lot of overhead, and could possible be unreliable.

    A better solution would be to have a script on the external site that when accessed would do a get to a URL on your WP install that would initiate maintenance mode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have wordpress blog in my custom built website, i am displaying some posts
I have a wordpress site that i've been working on that has some pages
I have wordpress installed on my website. On that site, under a subfolder i
I have a Wordpress based website, and some of the content is loaded through
I have a WordPress site that I need to create a custom PHP page
I have wordpress a site with a customized login page, the problem is when
i have an wordpress site and it have menus over there. what i want
I have a WordPress site which have 4 pages with one page is a
I have a Wordpress site (installed in root) and a Simple Machines Forum (in
I am hoping some smart folks can help me here. I'm out of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.