Skip to content

Commit

Permalink
[SITE-1134] Add documentation for configuring a WordPress multisite o…
Browse files Browse the repository at this point in the history
…n WP Composer Managed (#9173)

* add a multisite config page
copy pasta mostly

* update docs header

* add first pass of guide
need to add the images in

* add the images

* remove link to the configuration
it's wrong, and it doesn't add anything since we copy the config in the doc

* remove early access alert
it's already noted in the intro, no need to reiterate here, especially since all the subpages don't have it

* replace subdomain to subdirectory conversion with section on wpms search-replace
wpms search-replace does not work with composer-based sites yet, so for now, the workaround is still to use terminus/wp-cli

* updates from review

* rephrase intro paragraph
  • Loading branch information
jazzsequence authored Aug 28, 2024
1 parent 48e8ab6 commit 87162f9
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ showtoc: true
permalink: docs/guides/wordpress-composer
---

[Composer](https://getcomposer.org/) is a widely-used PHP dependency and package manager that provides a simplified method to manage packages (plugins, themes and -- with the [WordPress (Composer Managed) upstream](/wordpress-composer-managed), WordPress core itself) used by a WordPress site.
[Composer](https://getcomposer.org/) is a widely-used dependency and package manager for PHP. Composer provides an easy way to manage packages used by a WordPress site. Packages can be plugins, themes, other PHP libraries and even WordPress core itself.

At the most basic level, Composer requires:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: WordPress with Composer on Pantheon
subtitle: Multisite Configuration
description: Learn how to configure a WordPress multisite with Composer on Pantheon.
contenttype: [guide]
innav: [false]
categories: [dependencies]
cms: [wordpress]
audience: [development]
product: [--]
integration: [--]
tags: [wordpress]
contributors: [jazzsequence]
layout: guide
showtoc: true
permalink: docs/guides/wordpress-composer/multisite-configuration
anchorid: multisite-configuration
---

This section provides information on how to configure your WordPress (Composer Managed) site on Pantheon for WordPress multisite. This guide assumes that you have already set up a [WordPress Multisite upstream](/guides/multisite/#request-a-wordpress-multisite) and created a new site using that upstream. If you haven't already, you should also read through our [guide on WordPress Multisite](/guides/multisite) before beginning this process.

Because Bedrock uses `Config::define()` and `config/application.php` instead of traditional `define()` statements in `wp-config.php`, you will not be able to use WP-CLI via Terminus to enable multisite as documented in our standard [multisite configuration guide](/guides/multisite/config/).

<Alert title="Note" type="info">

Adjust placeholders in code snippets as needed throughout this guide. This includes placeholders such as `<site>` and `<env>` in Terminus commands, in addition to placeholders in brackets `<>` in larger code blocks.

</Alert>

## Set Up WordPress Multisite

1. Set the site's connection mode to Git:

```bash{promptUser: user}
terminus connection:set <site>.dev git
```
2. Open the `config/application.php` file in your site's codebase and add the following line anywhere _above_ the `Config::apply();` line:
```php
Config::define( 'WP_ALLOW_MULTISITE', true );
```
3. Visit your development site's WordPress admin and navigate to **Tools** > **Network Setup**.
![Network Setup page](../../../images/wordpress-composer/04-multisite-network-setup.png)
4. Choose **Sub-domains** or **Sub-directories** (depending on your needs), fill in the Network Title and Admin Email, and click **Install**.
5. You will be given instructions to update your `config/application.php` file. Below where you added the `WP_ALLOW_MULTISITE` line, copy and paste the code provided. The `SUBDOMAIN_INSTALL` value will be `true` or `false` depending on the option you chose in the previous step. For example, if you chose subdirectories, your `config/application.php` file should look like this:
```php
Config::define( 'MULTISITE', true );
Config::define( 'SUBDOMAIN_INSTALL', false );
// Use PANTHEON_HOSTNAME if in a Pantheon environment, otherwise use HTTP_HOST.
Config::define( 'DOMAIN_CURRENT_SITE', defined( 'PANTHEON_HOSTNAME' ) ? PANTHEON_HOSTNAME : $_SERVER['HTTP_HOST'] );
Config::define( 'PATH_CURRENT_SITE', '/' );
Config::define( 'SITE_ID_CURRENT_SITE', 1 );
Config::define( 'BLOG_ID_CURRENT_SITE', 1 );
```
6. Save your changes and commit them to your Git repository. WordPress will prompt you to log back in after you push the changes.
7. Log into your site. When you log back into your WordPress admin dashboard, you will see a new **My Sites** menu item in the top left corner. This is where you can manage your network of sites. You now have a WordPress subdirectory multisite network set up on a WordPress (Composer Managed)-based upstream.
![My Sites](../../../images/wordpress-composer/04-multisite-my-sites.png)
## Using Subdomain Multisite on Pantheon
Pantheon does not support sub-subdomains on the `pantheonsite.io` platform domain. This means that sub-sites on a subdomain multisite will not be accessible by default. See the [Mapping Custom Hostnames](/guides/multisite/config/#map-custom-hostnames-subdomain-configurations-only) panel in the Multisite Configuration guide for how to set up a custom domain for your sub-sites.
## Multisite Search and Replace with WordPress (Composer Managed)
Currently, the built-in dashboard [WordPress Multisite Search and Replace](/guides/multisite/search-replace/) does not support Composer-based WordPress multisites. To perform a search and replace on a WordPress (Composer Managed) multisite, you will need to use WP-CLI via Terminus manually. For more information, see our [WordPress Multisite Search and Replace](guides/multisite/workflows/#run-wp-cli-search-replace-manually) guide.
## More Information
* [WordPress Multisite Configuration](/guides/multisite/config/)
* [WordPress Multisite Search and Replace](/guides/multisite/search-replace/)
* [WordPress Multisite documentation](https://developer.wordpress.org/advanced-administration/multisite/)
* [WordPress Multisite Domain Mapping](https://developer.wordpress.org/advanced-administration/multisite/domain-mapping/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 87162f9

Please sign in to comment.