Developing a WordPress site on a live url

Developing a WordPress site on a live url

There are a many ways to develop a website in WordPress, locally, on a sub-domain or on a staging server but these ways mean that you will eventually have to migrate the site to a the live url at some point and sync the database. Although very achievable it can be a pain in the proverbial, especially if you are using some plugins that don’t store data in the database. Yes, you can use a plugin to make a website non public and develop that way but there’s more than one way to skin a cat!

This method will allow you to create a holding page, create a user as a subscriber and give them access to the site as it would be seen on a public url without giving them access to the dashboard.

So first off you will need WordPress installed on the server and on the url you intend the site to go live on. You will also need a simple holding page build with simple html like so:

 <title>New Website coming soon!</title>
 <h1>Congratulations you've just redirected non logged in users to this holding page.</h1>

Save that file in your theme folder and call it ‘holdingpage.php’

Now you need to redirect any users coming to the site to this page. You can simply do that by either putting this code in your index.php, home.php file or a template file that you might be using as the front page for your wordpress site. With the following I’ve used a custom template that is being used as the front page set in the WordPress dashboard under Settings > Reading.

 /* Template Name: Custom Page */
 if ( !is_user_logged_in()) {
 get_header(); ?>

*** UPDATED ***

Rather than redircting on an individual template it might be better to create an overall function filter that will apply to all of your theme files including page.php, single.php, archive.php etc etc. the way to do that is to add a filter hook to the wp_headers function, add this to your themes function.php file:

function sthn_header_redirect() {
 if ( !is_user_logged_in()) {
 add_filter('wp_headers', 'sthn_header_redirect');

*** UPDATED ***

This will redirect any non logged in users to the page called holdingpage.php in the theme folder. Now you can start to develop your WordPress site without worrying your client is going to look unprofessional with an under developed site, and they will be happy because they’ve got a nice neat holding page. To stop spiders crawling the site just put a disallow on the root in a robot.txt file in the main directory of your website.

After sometime you will have your site well under development and perhaps you’ll want to show the client some progress. No problem, what you’ll need to do is set them up as a user for the site specifically as a subscriber but first you need to paste this in to your functions.php file:

//redirect subscribers to the home url
add_action( 'admin_init', 'custom_profile_redirect', 12 );
function custom_profile_redirect() {
global $current_user;
if ($current_user-&gt;user_level == 0)
wp_redirect( home_url() ); exit;

This will redirect subscribers to the home url and because they are logged in not only will they bypass the dashboard they will also bypass the holding page conditional and load the theme as it would normally on a live site.

The next bit of code is optional but, by putting it in the function.php file it will hide the admin bar from the user – handy if you just want the user to see the site as it would look live.

// hide adminbar
if (!current_user_can('administrator')) :

Once the user (subscriber) has logged in they will need to logout or they might never see their lovely holding page again! Now we wouldn’t want to cause any unnecessary panic would we! So, it’s worth putting a logout url and you can do that by dropping this in to your header or footer somewhere:

&lt;?php echo wp_logout_url( home_url() ); ?&gt;

There are other applications for this and this is just a simple “Developing a WordPress site on a live url” technique that you can use for your clients, any other ways would be useful to hear about so feel free to leave a comment.


Graphic designer, web designer, frontend coder and partner at Square One a graphic and web design company in Cheltenham, interested in astronomy and sometimes cooks! Favourite cuisine includes Italian and Wordpress.

Discussion 24 Comments

24 responses to “Developing a WordPress site on a live url”

  1. Hi Elliott, I have to say I’ve never seen this method used before.

    I would normally just build a normal holding page, and build WordPress in a new Directory then move out the index.php, and wp-config. Does this method have any benefits? I know it “could” be found but my directory normally has a random name that couldn’t be guessed.

    I appreciate your opinion, it certainly seems a far more professional way to do things.


    • Thanks for the feedback Lorraine.
      Although your directory is not public – spiders could technically still crawl and index your pages in Google without a block on that directory. The benefit of doing it this way for me is to cut out the hassle of re-syncing the database and correcting the permalinks no other reason really 🙂 – for live sites that are already running on a url I still have to develop in a similar way to you and have the agro of the re-syncing.
      This is just an attractive alternative that uses the wp core to login also, users can get familiar with the wp login process 😉

  2. Hi Elliott

    Very interesting article, thanks for sharing. This is definitely the way I will try when developing my next WP site. So much cleaner than migrating the site and setting it up again.


  3. I do think I had a site crawled recently in that way. I think I’ll give it try on a site I’m building locally at the moment. I guess that is where the real benefit is. I have been caught out showing a site to a client and the images are missing in places as to me they are still reading from my hard drive as I’ve missed a few links. I do check every site on the iPad now but you are right, it would save that whole issue altogether.

    Thanks for sharing this Elliott.

    • You’re welcome.

      I’m sure you already know this but, just make sure you disallow the root in the robot.txt and you should be fine:

      User-agent: *
      Disallow: /

      Don’t forget to change to Allow: / once the site is live.

  4. Li Ming says:


    Read your post and it’s pretty interesting. A nice and professional way to do things. Will perhaps try this in the future. Thanks for this, Elliot

  5. Dan says:


    For those that don’t want to get too techy or code files, this is a nice WP plugin to handle maintenance and can be used when you need to take the site offline in future.


  6. Todd M. says:

    Will definitely try this some day, I usually use the Maintenance Mode plugin though 😀

    • Hey thanks for stopping by Todd.
      Yup, I’ve used the Maintenance Mode plugin myself and it’s a very useful plugin but, when it comes to adding that little touch of branding I find the manual option better.

      • Todd M. says:

        Agreed, the little credit in the corner can often be a bit sucky 🙂 but it’s dead easy to implement if you’re only showing a client amendments back and forth.

  7. This is exactly the third posting, of yours I actually
    went through. Nonetheless I personally love this 1,
    “Developing a WordPress site on a live url” the most.

    All the best -Melodee

  8. Luker says:

    Hi Elliott,
    Very nice way of doing this. I hate the aggro of the migration too. My question would be if there is a working site on the url, but *not a WP site, theoretically redirecting visitors to the existing site would allow the development to take place ‘cloaked’ as it were. Meaning the existing site functions as usual while the WP site is developed in the background. Rather than having to put up some kind of holding page. Would this work? I guess not if the site uses another CMS like Joomla or? But if the original site were html based?
    Thanks for the tips btw 🙂

    • I depends how the server is set up, if it’s running apache and the current CMS is using PHP it might cause an issue if the current site needs to stay active, my suggestion would be to use a sub domain eg: then you can develop the site in its own directory, once you are ready to go live you can move the files in to the root and use a search and replace script like interconnectit’s search and replace database tool.
      Hope that answers your question.

  9. This post has been updated to include an overall function that applies to the whole theme rather than an individual template.

  10. Oh my goodness! Incredible article dude! Thank you, However I am having difficulties with your
    RSS. I don’t know why I can’t join it. Is there anybody else getting similar RSS issues?
    Anyone that knows the solution will you kindly respond? Thanx!


  11. Sarvesh says:

    Hi Elliott, I just tried to use this method for my fresh wp 3.6 installation. I used your updated method, i.e.

    function sthn_header_redirect() {
     if ( !is_user_logged_in()) {
     add_filter('wp_headers', 'sthn_header_redirect');

    and i got an blank page. Later I figured out that it should be ‘holdingpage’ instead of ‘holding’ on third line. And bang.. it shows me the Coming soon page.
    Now the problem is that when I log in to wp as admin and click on ‘visit site’ it still shows me holding page (coming soon page)

    Please help.


Rowan Burton, DART

Absolutely delighted with the service I received from Square One . As trustee of a charity I was tasked with getting an effective website up and running quickly and inexpensively. Square One suggested their own template options but did all the hard work for me and accommodated all my changes efficiently and without complaint. And … read more