WPLift is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

How To Generate a Static Site From WordPress Using Staatic – Static Site Generator

Last Updated on April 12th, 2023

Tags: , , ,

A couple of years ago, WPLift published an article titled “How to Use a WordPress Static Site Generator to Make WordPress Static.” That article used the WP2Static plugin as an example.

WP2Static has since been taken over by Strattic. It is no longer available in the WordPress plugin directory, although you can still get it through the plugin website.

However, while Strattic announced that it would continue to maintain and support WP2Static, they are a competing and commercial WordPress static hosting company. Therefore, the plugin’s future looks rather haphazard .

Fortunately, a great alternative is now available – Staatic – and I will be focusing on that today. So, let’s jump straight in.

What is a Static Site?

To recap, if you haven’t read the article mentioned above, a static WordPress site uses static rather than dynamic content. That minimizes server resource usage, leading to blisteringly fast page loading times. Furthermore, static websites are less prone to malicious attacks than their dynamic counterparts.

You can use static sites if you rarely make changes to your site, and it does not rely on dynamic content (e.g., WooCommerce stores) where things are continually changing.

Static sites are great for things like:

  • Basic portfolios
  • Online resumés
  • Brochure-type websites as used by wedding sites, small business such as consultants, etc.
  • Basic blogs

Sites built using WordPress are dynamic, but conversion to static is easy using a plugin such as Staatic. The converted site will consist of HTML assets, images, scripts, etc., but with WordPress and PHP stripped away. The result is pages requested from your site are served immediately, eliminating the need for them to be generated on the fly.

Remember that if your WordPress site uses plugins requiring dynamic server-side functions (such as forms and searches), they won’t work on a static site. A workaround for this is to modify the static site to emulate the plugin or upgrade to a premium Staatic plan which includes features to alleviate this problem.

Key Features of Staatic

Homepage of Staatic website

Given the original WPLift article I mentioned above focused on the free version of WP2Static, I think it is only fair that I stick with the equivalent version of Staatic for this article.

In its free guise, Staatic gives you the following key features:

  • A powerful crawler that allows for fast transformation of your dynamic WordPress site to a static one
  • Multiple deployment methods – for example, Netlify, Amazon Web Services S3, CloudFront, local server (dedicated or shared hosting), etc.
  • Additional URLs, paths, redirects, and exclude rules supported
  • HTTP redirects, custom “404 not found” page, and other HTTP headers
  • Publish from the command line using the CLI command
  • Compatible with WordPress MultiSite and HTTP basic authentication protected WordPress installations

Of course, the premium version of Staatic includes plenty more functionality, and I will discuss that later. However, the free version is the perfect starting point for newbies to static WordPress site creation.

Installing and Setting Up Staatic

Firstly, I strongly suggest you read through the plugin documentation, which gives step-by-step instructions on what you need to do next to install, configure, and use Staatic.

However, in simple terms, the process is as follows:

1. Verify system requirements and enable PHP extensions

To use Staatic, your source site needs to be running using WordPress 5.0 or greater. Furthermore, the PHP version needs to be at least 7.0, although 7.4 is preferable as it includes greater security features.

You will also need to check four PHP extensions (Mbstring, Json, XML, and Zip) are enabled. How you do that depends on the admin tools your site hosting company provides. For example, if your hosting provider uses cPanel, you can access the PHP extensions by clicking on ‘Select PHP Version’ under ‘Software.’

Location fo the 'Select PHP Version" option in GreenGeeks cPanel

Once you click on that, you will see all available extensions and whether they are currently enabled.

PHP extensions in GreenGeek cPanel

2. Create a new (sub)domain and database

As a new static website will replace your existing one, the developer recommends creating a clone before proceeding with the migration process. This entails creating a new (sub)domain and database for the cloned site.

As with the PHP extensions, how you do that depends on the admin tools available to you. In the case of cPanel, you create a new domain (or subdomain) using the ‘Domains’ option and a corresponding database using ‘MySQL Database Wizard.’

Location of the Subdomains option in GreenGeeks cPanel
Location of the MySQL Database Wizard in GreenGeeks cPanel

3. Clone your WordPress site

There are many ways of cloning your site. The Staatic documentation suggests using the free Duplicator plugin, available in the WordPress plugin directory. Install and activate that as you would any other plugin. Then, follow the instructions in the Staatic documentation to create the clone.

4. Restrict access to WordPress

The documentation recommends restricting access to the WordPress version of your site and suggests using HTTP basic authentication to do that.

Setting up HTTP basic authentication is usually done at the web server or hosting control panel level. Apache is the commonly used web server and requires you to create a .htpasswd file and update the .htaccess file. You can find a step-by-step tutorial on the TransIP website that leads you through this process. Whats more, it also has a .htpasswd generator.

5. Decide on your static site deployment strategy

With Staatic, you can publish your static site to the same server currently hosting your WordPress installation (i.e., local directory,) or alternatively, you can use one of the supported cloud providers (such as Amazon Web Services or Netlify.)

Depending on your choice, you will need to review the documentation relating to each deployment type to see if any additional preparation steps are necessary before installing the Staatic plugin.

6. Install and activate the Staatic plugin

Staatic is added to WordPress and activated in the same way as any other plugin. Once that is done, a new menu item will appear in your WordPress backend, giving you access to the plugin’s features:

Location of the Staatic item in the WordPress admin panel menu

7. Configure the plugin’s ‘Build’ settings

The first port of call is the ‘Build’ tab of the Staatic backend menu.

Here, you need to enter the destination URL of the site you wish to publish, which can either be absolute, relative, or offline. It’s also possible to specify additional URLs, paths, and redirects that the static build must include or exclude.

A short description of each option is available under each field in the Build tab, while detailed explanations are available in the ‘Build Settings’ section of the documentation.

Staatic Build settings menus

8. Configure the ‘Deployment’ settings

Next, you must configure the various deployment options in the ‘Deployment’ tab.

A dropdown box gives the options for where to create the static site: your local directory, Amazon Web Services, Netlifly, or Zip file.

The options in this panel will vary depending on the deployment method chosen. Again, the Deployment tab contains brief explanations of each option, with more detailed explanations available in the ‘Deployment Settings’ section of the user documentation.

Staatic Deployment settings menus

9. Configure the ‘Advanced’ settings

The ‘Advanced’ tab allows you to refine how Staatic works. It includes options like logging (for troubleshooting purposes,) HTTP timeout and delay settings, etc.

In this panel, you will need to add the HTTP Authentication details, assuming you took the developer’s advice and set up HTTP basic authentication to prevent public access to your WordPress site.

Before doing anything with the advanced settings, I strongly suggest you read the ‘Advanced Settings’ section of the user documentation

Staatic Advanced settings menus

10. Create your new static site

Once you have made all your configurations in the Build, Deployment, and Advanced tabs, all you need to do is click ‘Staatic’ in the very top bar of your WordPress admin panel and choose ‘Publish’ from the dropdown:

Location of the Staatic publish static site publish button in the WordPress admin panel top bar in

After a few moments, the new static site is created, and a Publication Summary will appear:

Staatic Publication Summary displayed in the WordPress admin panel after a static site is published

And here is the static site as published:

Example of a static site published with Staatic

Staatic Premium Plans

The free version of Staatic includes plenty of great features that will be sufficient for many users. However, the Premium plans bring considerably more versatility to the table, including:

  • Forms integration – removes the need to find external form handling solutions
  • Search integration – all posts and pages are kept indexed and are searchable using a neatly integrated search widget
  • Quick publications – Publishes only the changes made, thereby speeding up publication times
  • Scheduled publications – you can publish your WordPress site automatically based on a predefined schedule or event.
  • Extensive API – allows those of you with enough coding knowledge to add your own custom features

Currently, Self-hosted plans cost €9 per month for the Starter package, which covers one website, and €29 per month for the Business package, which covers up to three sites and includes multiple team members, priority support, and a 99.95% guaranteed uptime service level agreement (SLA).

Cloud-hosted plans cost €19 per month for Starter and €69 for Business.

If you need unlimited sites, self and cloud-hosted Enterprise plans are also available, the price of which requires a discussion directly with Staatic’s sales team.

A 14-day free trial of the premium plans is also available, and refreshingly, you don’t need a credit card to avail of that.

Get Staatic Premium Get Staatic Free

Staatic Pros and Cons

As with all plugins and software, Staatic has both good and bad points:

Pros

  • The free version contains sufficient features for many applications
  • Premium plans are good value and include many useful extra features
  • Once configured, you can create blisteringly fast static sites with a single click
  • Comprehensive documentation

Cons

  • While the documentation is good, it could benefit from the addition of some visual content, such as screenshots
  • Total beginners may struggle with some of the setup, which involves working in the web server or hosting control panel
  • Community support is limited as Staatic is still relatively new to the market

The Final Verdict

Following the sudden demise of WP2Static, Staatic’s static site generator has come at precisely the right time to offer a viable alternative. The availability of a fully-fledged free version is good news for people wanting to dabble with generating static versions of their WordPress sites. At the same time, the premium plans are ideal for those craving more functionality at a sensible price.

So, if you want to generate a super-fast static version of your WordPress site, the Staatic plugin checks all the right boxes.

A team of WordPress experts that love to test out new WordPress related software, WordPress plugins and WordPress themes.