is .maintenance file still valid for putting WP in maintenance mode?

Not really.

.maintenance is a temporary file, not viable if you want to put your site in maintenance mode for a long time.

If you look at source the maintenance mode is maintained only if $upgrading variable defined in the file is no older than 10 minutes.

It means .maintenance is a sort of lock file when WordPress is upgrading plugins, themes or itself, something that should not last more than 10 minutes.

Surely is possible to insert into that file something like:

$upgrading = time();

And in theory hold WordPress in maintenance mode, but once it is intended to be a temporary file, WordPress feels free to delete the file after a successfull update.

For a long-duration maintenance mode you need to use a different solution.

Here you’ll find one.

Leave a Comment