How to replace paths from WordPress

Much like a lot of Hide WordPress plugins Simply Static ships with the ability to automatically replace the default paths of WordPress on your static site.

This is useful if you want to hide the fact that you are using WordPress when running it on a static WordPress setup.

A common misconception is that it helps with security—it does not—it just makes the code look a bit nicer.

How to set it up

In your admin area, move to Simply Static -> Settings -> Optimize -> Replace, and you should see the settings like this:

While these settings are pretty self-explanatory, let's examine each one and learn about the specifics of what these directories do and which settings depend on each other.

WP-CONTENT directory

This is the directory that contains all the modifications you make to your WordPress website, including plugins, media files, and themes.

You can rename it, but you will need a value for this setting. If you don't add one, Simply Static will fall back to wp-content.

WP-INCLUDES directory

This directory is coming from WordPress core. You will not touch it when working with WordPress, as all changes will be overwritten with the next WordPress update.

However, you might want to replace this directory with something like "core" on a static site.

WP-CONTENT/UPLOADS directory

This directory stores all the media assets you've uploaded via the media section in WordPress: images, PDF files, videos, and so on. It's one of the most common indicators for people that this website is powered by WordPress.

A common name for this directory on your static site might be "media".

Important: All the settings work independently, which means even if you change the WP-CONTENT directory to "content" and you want to rename UPLOADS to "media" you set the path in the settings to wp-content/media and NOT content/media.

Here is a screenshot to make the configuration a bit more clear for the scenario mentioned above:

PLUGINS and THEMES directories

Similar to the wp-content/uploads directory, these settings work independently from the wp-content directory.

make sure to stick with wp-content when replacing them, even if wp-content was renamed in the settings above.

Replace Plugin Names

This option will replace plugin names with a randomly generated string. We replace all plugins automatically; the only exception is Simply Static itself, as we need to reference the paths for certain features (like the forms and search integration).

Theme Style Name

The main CSS file in each WordPress theme is called style.css.

This is mandatory to make a theme work with WordPress. However, on a static site, we are no longer limited to that.

If you want to rename your style.css file to index.css, you can do that, and we will replace it automatically within the generated HTML.

Author URL

WordPress automatically generates author archives for each user that publishes content on your WordPress website. While certain plugins (like most SEO plugins) can disable these archives for you, we wanted to offer a way to replace these URLs without a third-party plugin.

Example configuration

Here is a quick example configuration where we made the following changes:

  • wp-content should be content
  • wp-includes should be core
  • uploads should be media
  • plugins should be addons
  • themes should be templates
  • style.css should be index.css

This is a pretty common configuration and completely hides the fact that the statically converted website is based on WordPress.

Make sure to run a new static export once you've configured these settings to see the results, as the replacement will happen "on the fly" while running a static site export.

Video Tutorial