WordPress / By Chirag Unadkat / Published 23 Dec 2023

Unleashing the power of Bedrock: converting your WordPress installation

Read how to convert a WordPress installation to Bedrock for better security, maintainability, configuration and a cleaner development workflow for teams too.

WordPress has evolved with the needs of developers and site owners. One of those evolutions is Bedrock, a modern WordPress stack that aims to improve security, maintainability and the day-to-day development experience. This guide walks through converting a regular WordPress installation into a Bedrock one.

Understanding Bedrock

Bedrock is not a standalone CMS. It is a more structured way to organise a WordPress project, developed by the team at Roots. It brings a modular approach to WordPress by using Composer, the PHP dependency manager. Its key features are:

  • Dependency management with Composer: plugins and themes are easy to include and manage, which helps with version control and dependency resolution.
  • Environment configuration: the dotenv PHP library keeps environment-specific settings in a .env file, separate from the code.
  • Improved directory structure: core files are organised for clean, modular development, and a separate web folder holds the publicly accessible files.
  • Security enhancements: wp-config.php is not exposed to the web, and the setup encourages secure salts and keys for encryption.

Prerequisites

Before you start, make sure you have:

  • A backup: always back up your WordPress site before making significant changes, so you can revert if something goes wrong.
  • Composer: install it on your machine if you have not already. Instructions are on the official Composer website.

Conversion steps

  1. Create a Bedrock project. In your terminal, go to the directory where you want the project and run:

    composer create-project roots/bedrock your-project-name
    
  2. Move your WordPress files. Move your existing wp-content directory into the Bedrock project so that themes go in web/app/themes and plugins go in web/app/plugins.

  3. Configure the environment. Move the settings from your existing wp-config.php into the .env file in the Bedrock project, including your database credentials and other environment settings.

  4. Install dependencies. In the Bedrock project directory, run composer install to install what composer.json specifies.

  5. Test your site. Visit the site and check that everything works as expected.

Where this leaves you

Once the steps above are done, your traditional installation is a Bedrock-powered project: more modular, easier to maintain and more secure. From here you can explore Bedrock's additional features and integrations to refine your workflow further.

Talk to us

If you want help migrating a WordPress site or building on a modern PHP stack, see our web development services or get in touch.

Start a project

Let's build something fast.

Book a 30-min call

By submitting you agree to our Privacy Policy. No obligation.

Get a fixed-price quote →