Home  >  Article  >  CMS Tutorial  >  How to temporarily shut down WordPress website for maintenance

How to temporarily shut down WordPress website for maintenance

尚
Original
2019-07-13 09:59:475630browse

How to temporarily shut down WordPress website for maintenance

Sometimes access errors may occur on our website due to various reasons. At this time, we need to temporarily close the site for maintenance. So how do we temporarily close the site for maintenance? Let's take a look at how to temporarily shut down our site.

1. .maintenance method

Create a new file named .maintenance in the WordPress root directory. The content is:

<?php $upgrading = 1234567890; ?>

The number is the Unix timestamp. You can Obtained through the PHP function time() or strtotime(). Before the time specified by this timestamp and 600 seconds thereafter, WP will be in "maintenance mode", and all pages accessing the entire site will display "Briefly unavailable for scheduled maintenance" . Check back in a minute”, the backend management system is also unable to be entered.

If you are not sure about the maintenance time and want to manually switch to non-maintenance mode, you can modify the content of the .maintenance file to:

<?php $upgrading = time(); ?>

To stop maintenance mode, just delete the .maintenance file. .

If you don’t like that prompt, you can modify it. WP2.9 is located in the attachment on line 139 of wp-settings.php, and WP3.0 is located near line 164 of wp-includes/load.php. The original prompt page content As follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title><?php echo /*WP_I18N_MAINTENANCE*/&#39;Maintenance&#39;/*/WP_I18N_MAINTENANCE*/; ?></title>
</head> 
<body> 
<h1><?php echo /*WP_I18N_MAINT_MSG*/&#39;Briefly unavailable for scheduled maintenance. Check back in a minute.&#39;/*/WP_I18N_MAINT_MSG*/; ?> 
</h1> 
</body>

In addition, the above situation may also occur when upgrading the plug-in fails, and can be resolved by deleting the .maintenance file.

2. Maintenance mode plug-in (recommended: How to install WordPress plug-in)

You can download the maintenance plug-in from the official website or Baidu, upload it and enable it, and you can set up maintenance The user level displayed on the time and maintenance pages can ensure that administrators can perform normal operations and browse in the background and foreground, while ordinary users will only see the maintenance prompt page.

For more wordpress related technical articles, please visit the wordpress tutorial column to learn!

The above is the detailed content of How to temporarily shut down WordPress website for maintenance. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn