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
.envfile, separate from the code. - Improved directory structure: core files are organised for clean, modular development, and a separate
webfolder holds the publicly accessible files. - Security enhancements:
wp-config.phpis 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
-
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 -
Move your WordPress files. Move your existing
wp-contentdirectory into the Bedrock project so that themes go inweb/app/themesand plugins go inweb/app/plugins. -
Configure the environment. Move the settings from your existing
wp-config.phpinto the.envfile in the Bedrock project, including your database credentials and other environment settings. -
Install dependencies. In the Bedrock project directory, run
composer installto install whatcomposer.jsonspecifies. -
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.
Related posts
- WordPress Multisite: a step-by-step guide to setup and managementSee how WordPress Multisite brings multiple websites into one network, covering installation, network configuration, site administration and ongoing management.
- 10 reasons to hire a WordPress expertFind out how a WordPress expert can improve customisation, security, SEO, website speed and ongoing support to help your business get more from its website.
- How PHP web development improves website speed and securityUnderstand how custom PHP development can improve website speed, security and maintainability, with more flexibility than generic templates and CMS platforms.
Start a project