trendwerk / domains
Domains for WordPress Multisite.
Installs: 6 371
Dependents: 0
Suggesters: 0
Security: 0
Stars: 24
Watchers: 5
Forks: 1
Open Issues: 0
Type:wordpress-muplugin
Requires
- php: >=5.4
- composer/installers: ~1
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-26 20:39:45 UTC
README
Domains for WordPress Multisite.
Requires WordPress 4.5+. Specifically meant for using domains on subdirectory Multisite installs.
Note: This plugin does not replace all existing URLs in the database. Therefore, it is recommended to install this immediately after creating a multisite install.
Installation
If you're using Composer to manage WordPress, add this plugin to your project's dependencies. Run:
composer require trendwerk/domains
Setup
The basic setup of this plugin consists of two steps:
- Define the correct constants in your WordPress configuration file (default:
wp-config.php
) - Configure the
.domains
file, which is the main configuration file for this plugin
Constants
define('SUNRISE', true);
This activates a WordPress drop-in plugin called sunrise.php
. Allows this plugin to perform actions right before Multisite is loaded.
define('CONTENT_DIR', '/app');
This is only necessary if your content folder is not located in the default /wp-content
folder. The example above uses /app
.
define('DOMAIN_CURRENT_SITE', 'www.example.com');
Probably not necessary to say, but this should be defined when using Multisite. This plugin relies on it being defined as well.
Omit these constants
Never define the following constants when using Multisite and this plugin:
WP_CONTENT_URL
- should be defined by this pluginWP_HOME
- not used by MultisiteWP_SITEURL
- not used by Multisite
Configuration
The .domains
file is the main configuration file for this plugin and contains all domains. It is set up in the format blogId:domain
. Domain aliases can be created by separating domains by a comma. For example:
2=www.example.com,example.com
3=www.example.org
The domains file should be located in the root of your project. This file should probably be excluded from version control, since enviroments are usually run on different domains. When using Capistrano for deployment, it should be defined as a linked file.
Note: This plugin searches for the .domains
file in the folder where WordPress is located and a maximum of two folders up.