The Plugin Preview Button
Enabling Plugin Previews
-
A valid blueprint.json file must be provided in a blueprints sub-directory of the plugin’s assets folder. -
The plugin preview must be set to “public” from the plugin’s Advanced view by a committer.
Blueprints
{ "landingPage": "\/wp-admin\/edit.php", "preferredVersions": { "php": "7.4", "wp": "5.9" }, "phpExtensionBundles": [ "kitchen-sink" ], "steps": [ { "step": "login", "username": "admin", "password": "password" } ] }
landingPage , which specifies the URL of the page that the user will land on when the preview loads. preferredVersions , which specifies versions of PHP and WordPress. phpExtensionBundles , which in this case specifies that we want most common PHP extensions to be available (kitchen-sink). steps , which tells Playground what to do before displaying the landing page. In this case, it will simply log the user in to wp-admin.
{
"landingPage": "/wp-admin/post.php? post=5&action=edit",
"preferredVersions": {
"php": "7.4",
"wp": "5.9"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org\/plugins",
"slug": "my-imaginary-plugin-dependency"
},
"options": {
"activate": true
}
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org\/plugins",
"slug": "my-imaginary-plugin"
},
"options": {
"activate": true
}
},
{
"step": "installTheme",
"themeZipFile": {
"resource": "wordpress.org\/themes",
"slug": "my-imaginary-theme"
}
},
{
"step": "setSiteOptions",
"options": {
"some_required_option_1": "your_favorite_values",
"some_required_option_2": "your_favorite_values"
}
},
{
"step": "runPHP",
"code": "<? php require_once 'wordpress/wp-load.php'; wp_insert_post(array('post_title' => 'wp-load.php required for WP functionality', 'post_status' => 'publish')); ?> "
}
]
}
Using a generated Blueprint file
Your plugin does not yet have a blueprint file for user previews. If you'd like to enable previews, please follow these steps to create a blueprint. 1. Test your plugin in Playground. 2. Fix any bugs in your plugin that prevent it from working in Playground. 3. Download blueprint.json 4. Commit your blueprint to svn.
Committing a Blueprint to Subversion