Yet another modern WordPress boilerplate with Composer, an easier configuration, and an improved directory structure.
This boilerplate is based on Bedrock.
If you have the capability, please consider sponsoring Roots.
This boilerplate assumes you are familiar with Bedrock.
Differences with Bedrock:
- The Web root directory is
public
instead ofweb
. - The WordPress core directory is
wordpress
instead ofwp
. - The WordPress content directory is the same path as the Web root.
- In vanilla WordPress, this is the
/wp-content
directory. - In Bedrock, this is the
/web/app
directory. - In Jazz, the directory structure is simplified:
/public/plugins
/public/mu-plugins
/public/themes
/public/uploads
/public/wordpress
- In vanilla WordPress, this is the
- The primary configuration file in Bedrock (
/config/application.php
) is split across multiple files:/config/bootstrap.php
— Bootstraps the environment variables, WordPress environment type, and configuration files./config/application.php
— Production configuration for your WordPress application./config/wordpress.php
— Base configuration for WordPress (equivalent ofwp-config.php
).
- Roots'
WP_ENV
constant is superseded by WordPress'WP_ENVIRONMENT_TYPE
constant.- The former is still defined because its required by dependencies and plugins by Roots.
- PHP >= 7.4
- Composer (Installation)
-
Create a new project:
composer create-project wp-jazz/wp-project-skeleton
-
Update environment variables in the
.env
file.Wrap values that may contain non-alphanumeric characters with quotes, or they may be incorrectly parsed.
-
Database variables:
-
DB_NAME
— Database name -
DB_USER
— Database user -
DB_PASSWORD
— Database password -
DB_HOST
— Database host -
Optionally, you can define
DATABASE_URL
for using a DSN instead of using the variables above:DATABASE_URL="mysql://user:password@127.0.0.1:3306/db_name"
-
-
WP_ENVIRONMENT_TYPE
— Set to environment (development
,staging
,production
) -
WP_HOME
— Full URL to WordPress home (https://example.com) -
WP_SITEURL
— Full URL to WordPress including subdirectory (https://example.com/wordpress) -
AUTH_KEY
,SECURE_AUTH_KEY
,LOGGED_IN_KEY
,NONCE_KEY
,AUTH_SALT
,SECURE_AUTH_SALT
,LOGGED_IN_SALT
,NONCE_SALT
- Generate with wp-cli-dotenv-command
- Generate with our WordPress salts generator
-
-
Add plugin(s) in
public/plugins
andpublic/mu-plugins
, and theme(s) inpublic/themes
either:- as you would for a normal WordPress site (add an exception to the
.gitignore
if you want to index them) - or as Composer dependencies.
- as you would for a normal WordPress site (add an exception to the
-
Set the document root on your Web server to the
public
directory:/path/to/site/public/
. -
Access WordPress admin at
https://example.com/wordpress/wp-admin/
.
Contributions are welcome from everyone. We have contributing guidelines to help you get started.
This boilerplate is based on the solid work of many that have come before me, including:
- Assely
- Bedrock
- Dioscuri
- felixarntz/wp-composer-stack
- markjaquith/wordpress-skeleton
- mrgrain/autobahn
- Themosis
- WordPlate
🎷