How to create a "Coming Soon" page with WP-CLI


Learn how to instantly deploy a beautiful maintenance or coming soon page to your WordPress site using a single terminal command.

Overview

If you need to quickly hide your site from the public while you perform maintenance or build out a new design, using a "Coming Soon" page is the best approach. Rather than clicking through the WordPress dashboard, you can achieve this in seconds using WP-CLI and the popular CMP (Coming Soon & Maintenance) plugin.

The WP-CLI Command

Log in to your server via SSH, navigate to your WordPress root directory, and run the following one-line command:

Terminal
wp plugin install cmp-coming-soon-maintenance --activate && wp option update niteoCS_status 1 && wp option update niteoCS_title "$(wp option get blogname)" && wp option update niteoCS_body "<h2>We are giving our website a little polish. Grab a coffee and check back in a bit\!</h2>" && wp option update "niteoCS_overlay[color]" "#2d3748" && wp option update niteoCS_login_icon 1 && wp option update niteoCS_body_title "Something great is coming soon\!"

What does this script do?

This script chains together several WP-CLI commands using && to execute them sequentially. Here is a breakdown of exactly what is happening behind the scenes:

  • Installs and activates the plugin: wp plugin install cmp-coming-soon-maintenance --activate downloads the CMP plugin from the WordPress repository and immediately turns it on.
  • Enables Coming Soon mode: wp option update niteoCS_status 1 switches the plugin status to "active", instantly hiding your main site from non-logged-in visitors.
  • Sets the browser title: wp option update niteoCS_title "$(wp option get blogname)" dynamically fetches your current WordPress site title and applies it to the Coming Soon page's SEO title.
  • Customizes the main message: wp option update niteoCS_body "..." inserts a friendly HTML sub-heading message explaining that the site is getting polished.
  • Sets the background overlay: wp option update "niteoCS_overlay[color]" "#2d3748" applies a sleek, dark slate-gray background color overlay to the page.
  • Enables the admin login icon: wp option update niteoCS_login_icon 1 places a subtle login icon on the page so that you and your team can still access the WordPress backend easily.
  • Sets the primary headline: wp option update niteoCS_body_title "Something great is coming soon\!" updates the large hero text on the center of the screen.

Note: Because you are logged in as an administrator (or executing this via server CLI), you will still be able to see the normal website. Only logged-out visitors will see the Coming Soon page. To preview it yourself, open your website in an Incognito or Private Browsing window.

How to turn it off

Once you are ready to reveal your website to the world again, you can easily disable the coming soon screen by running:

Terminal
wp option update niteoCS_status 0

Alternatively, you can just deactivate the plugin entirely:

Terminal
wp plugin deactivate cmp-coming-soon-maintenance

 


Was this answer helpful?

One email a month. Endless business benefits.

Don't miss out on WMTWWFY — the newsletter that keeps your website fast, safe, and visible.

« Back
Spinner
aluminium-anthropoid Security Check