Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_maintenance [ WordPress Function ]

wp_maintenance ( No parameters )
Access:
  • private
Defined at:



Dies with a maintenance message when conditions are met.

Checks for a file in the WordPress root directory named ".maintenance". This file will contain the variable $upgrading, set to the time the file was created. If the file was created less than 10 minutes ago, WordPress enters maintenance mode and displays a message.

The default message can be replaced by using a drop-in (maintenance.php in the wp-content directory).

Source


<?php
function wp_maintenance() {
    if ( !
file_existsABSPATH '.maintenance' ) || defined'WP_INSTALLING' ) )
        return;

    global 
$upgrading;

    include( 
ABSPATH '.maintenance' );
    
// If the $upgrading timestamp is older than 10 minutes, don't die.
    
if ( ( time() - $upgrading ) >= 600 )
        return;

    if ( 
file_existsWP_CONTENT_DIR '/maintenance.php' ) ) {
        require_once( 
WP_CONTENT_DIR '/maintenance.php' );
        die();
    }

    
wp_load_translations_early();

    
$protocol $_SERVER["SERVER_PROTOCOL"];
    if ( 
'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
        
$protocol 'HTTP/1.0';
    
header"$protocol 503 Service Unavailable"true503 );
    
header'Content-Type: text/html; charset=utf-8' );
    
header'Retry-After: 600' );
?>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'?>>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php _e'Maintenance' ); ?></title>

    </head>
    <body>
        <h1><?php _e'Briefly unavailable for scheduled maintenance. Check back in a minute.' ); ?></h1>
    </body>
    </html>
<?php
    
die();
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics