From 78e2929b27a0fd4e24863f00a49a26c9e1a1984a Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Tue, 22 Apr 2025 01:20:14 +0100 Subject: [PATCH] Add network-activated plugin to WordPress Playground multisite blueprint --- .wiki/Playground-Testing.md | 22 +++++++++++++++++++--- .wiki/Testing.md | 4 ++-- playground/multisite-blueprint.json | 4 ++++ playground/multisite.html | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.wiki/Playground-Testing.md b/.wiki/Playground-Testing.md index f48d3b3..fca57f3 100644 --- a/.wiki/Playground-Testing.md +++ b/.wiki/Playground-Testing.md @@ -17,9 +17,25 @@ The easiest way to test our plugin with WordPress Playground is to use the onlin 1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=4) -2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=16) +2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=17) -These links will automatically set up WordPress with multisite enabled. +These links will automatically set up WordPress with multisite enabled and the Hello Dolly plugin network-activated. + +## Plugin Activation in Multisite + +In a WordPress multisite environment, there are two ways to activate plugins: + +1. **Network Activation**: Activates a plugin for all sites in the network + - In the WordPress admin, go to Network Admin > Plugins + - Click "Network Activate" under the plugin + - Or use WP-CLI: `wp plugin activate plugin-name --network` + +2. **Per-Site Activation**: Activates a plugin for a specific site + - In the WordPress admin, go to the specific site's admin area + - Go to Plugins and activate the plugin for that site only + - Or use WP-CLI: `wp plugin activate plugin-name --url=site-url` + +Our multisite blueprint uses network activation for the Hello Dolly plugin as an example. ## Running Tests with WordPress Playground @@ -32,7 +48,7 @@ To run tests with WordPress Playground: 1. Open the appropriate WordPress Playground link: - [Single site](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=4) - - [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=16) + - [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=17) 2. Test the plugin manually in the browser diff --git a/.wiki/Testing.md b/.wiki/Testing.md index 2ebdd24..794a289 100644 --- a/.wiki/Testing.md +++ b/.wiki/Testing.md @@ -106,9 +106,9 @@ The easiest way to test our plugin with WordPress Playground is to use the onlin 1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=4) -2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=16) +2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=17) -These links will automatically set up WordPress with multisite enabled. +These links will automatically set up WordPress with multisite enabled and the Hello Dolly plugin network-activated. #### Local Testing with HTML Files diff --git a/playground/multisite-blueprint.json b/playground/multisite-blueprint.json index de993f1..f366b9a 100644 --- a/playground/multisite-blueprint.json +++ b/playground/multisite-blueprint.json @@ -12,6 +12,10 @@ { "step": "wp-cli", "command": "wp site create --slug=testsite" + }, + { + "step": "wp-cli", + "command": "wp plugin install hello-dolly --activate-network" } ] } diff --git a/playground/multisite.html b/playground/multisite.html index 2b733d8..9976f1d 100644 --- a/playground/multisite.html +++ b/playground/multisite.html @@ -20,6 +20,6 @@ - +