I installed a WordPress for a domain name. When I use this domain name will point to index.php in my template. I want show a under construction page for this domain name, but the other hand I still want work on index.php in my template.

6 Answers 6


You can filter template_include and include a special file for users who are not logged in:

/* Plugin Name: T5 Under Construction */

add_filter( 'template_include', 't5_uc_template' );

function t5_uc_template( $template )
    $uc_template = dirname( __FILE__ ) . '/under-construction.php';

    if ( ! is_user_logged_in() )
        return $uc_template;

    if ( ! current_user_can( 'administrator' ) )
        return $uc_template;

    return $template;

The file under-construction.php could be a plain HTML file; it doesn’t have to be a PHP file.


The simplest workaround would be to just add the static content in a new index.html file in the root, and the server should read the .html before the .php

  • 2
    That would affect all users, including the administrator.
    – fuxia
    Apr 25, 2013 at 10:23
  • But then you'd only change the Index, not the overall access to the website. Any deep link (such as http://example.com/category/post-name/ etc.) still would work.
    – tfrommen
    Apr 25, 2013 at 10:23

You can restrict depending on the IP address and Htaccess file.

<Files index.php>
  Order Deny,Allow
  Deny from all
  Allow from

where is your ip address.


Use maintenance mode plugin. Activate it. Once activate login as admin and you can only view your site. Other users can see maintenance message.


The simplest way would be using an maintenance or coming soon plugin. It will take a minute or 2 to setup the plugin and you're good to go.



You can just hook the current_user_can() function and the is_user_logged_in() function to get_header like this:

function shillongtitude_construction_mode() {
    if (!current_user_can(‘edit_themes’) || !is_user_logged_in()) {
      wp_die('<h1>Construction going on.</h1><br />Site currently under construction.');
add_action('get_header', 'shillongtitude_construction_mode');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.