Home > CMS Tutorial > WordPress > body text

How to close the website in wordpress

爱喝马黛茶的安东尼
Release: 2019-07-19 14:07:47
Original
6145 people have browsed it

How to close the website in wordpress

Enable WordPress maintenance mode and temporarily shut down the site

Sometimes, blog access errors may occur due to various reasons In this case, we turn on the maintenance mode at this time and give a maintenance prompt page.

Here are some methods for you

1. .maintenance method

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

<?php $upgrading = 1234567890; ?>
Copy after login

The number is the Unix timestamp, which can be 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", when accessing all pages of the entire site, "Briefly unavailable for scheduled maintenance. Check back in a minute" will be displayed, and it is also impossible to enter the backend management system.

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(); ?>
Copy after login

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

Related recommendations: "WordPress Tutorial"

If you don’t like that prompt, you can modify it. WP2.9 is located in the 139th line attachment of wp-settings.php. WP3.0 is located near line 164 of wp-includes/load.php. The original prompt page content is 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>
Copy after login

In addition, the above situation may also occur when upgrading the plug-in fails. You can delete the .maintenance file to relieve.

2. Maintenance mode plug-in

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

There are no instructions on how to use the plug-in, just take a look and you will know how to use it!

The above is the detailed content of How to close the website in wordpress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template