Make WordPress Core

Opened 2 years ago

Last modified 2 months ago

#60194 new feature request

Add Preview in Playground buttons to plugin install screens

Reported by: tellyworth's profile tellyworth Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.5
Component: Plugins Keywords: has-patch needs-design-feedback needs-design has-test-info
Focuses: administration Cc:

Description

Proposal: add Preview buttons to plugin install screens within wp-admin.

Background:

The WordPress.org Plugin Directory now supports a Live Preview feature based on Playground; see https://meta.trac.wordpress.org/ticket/7251 for context.

You can see an example working on the https://wordpress.org/plugins/convert-to-blocks/ plugin. Previews are currently only enabled on plugins where the developer has opted in and provided a blueprint.json file (which provides setup and configuration info).

The preview button on the web site works simply by redirecting from https://wordpress.org/plugins/PLUGIN-SLUG/?preview=1 to a playground.wordpress.net URL which loads the plugin's blueprint file. It opens the playground URL in a new window using target="_blank".

I'm proposing that we do essentially the same thing from within wp-admin, on screens with an Install button for plugins: add a Preview button, which opens https://wordpress.org/plugins/PLUGIN-SLUG/?preview=1 in a new window.

The wordpress.org plugins API already returns a preview_link property containing the appropriate URL for plugins with a working preview.

I'll attach a diff with a minimal implementation; this is intended as a starting point for testing and discussion, not a finished patch in its current state.

Attachments (5)

admin-plugin-preview.0.diff (2.2 KB) - added by tellyworth 2 years ago.
Initial draft patch for discussion and review
Screenshot 2024-01-12 at 5.00.47 pm.png (134.8 KB) - added by tellyworth 2 years ago.
Here's what the button looks like in the plugin search/card view.
Screenshot 2024-01-12 at 5.01.01 pm.png (199.8 KB) - added by tellyworth 2 years ago.
And here's what the button looks like on the plugin detail view (bottom left).
live-preview-button.png (154.1 KB) - added by nikunj8866 3 months ago.
Live Preview button link for Plugin Install Screen
live-preview-button-popup.png (173.6 KB) - added by nikunj8866 3 months ago.
Live Preview button on more detail popup.

Download all attachments as: .zip

Change History (13)

@tellyworth
2 years ago

Initial draft patch for discussion and review

@tellyworth
2 years ago

Here's what the button looks like in the plugin search/card view.

@tellyworth
2 years ago

And here's what the button looks like on the plugin detail view (bottom left).

#1 @tellyworth
2 years ago

  • Keywords has-patch dev-feedback needs-design-feedback added

I added two screenshots showing the current state of the UI - it's basic and needs some feedback from design as to whether or not it's acceptable.

#3 @nikunj8866
3 months ago

  • Focuses administration added
  • Keywords needs-test-info added; dev-feedback removed

https://github.com/WordPress/wordpress-develop/pull/10200 PR adds a "Live Preview" button to the plugin install screen, allowing users to try plugins in a Playground-based environment before installation.

The button is only displayed when:

  • The plugin provides a valid preview_link in its API data.
  • The plugin is not already installed.

This enhancement builds upon the WordPress.org Plugin Directory changes that introduced Live Previews (see meta ticket #7251).

Steps to Test

  1. Go to Plugins → Add New in the WordPress admin dashboard.
  2. Search for a plugin with a preview available. For example, try searching for "Convert to Blocks".
  3. Confirm that a "Live Preview" button appears next to "Install Now".
  4. The button should open the preview in a new browser tab.

@nikunj8866
3 months ago

Live Preview button link for Plugin Install Screen

#4 @nikunj8866
3 months ago

  • Keywords needs-design added

@nikunj8866
3 months ago

Live Preview button on more detail popup.

This ticket was mentioned in Slack in #core-test by nikunj8866. View the logs.


3 months ago

@rakib03029 commented on PR #10200:


3 months ago
#6

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://core.trac.wordpress.org/ticket/60194

Environment

  • WordPress: 6.8.3
  • PHP: 8.0.30-dev
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 5.5 / Client: 3.40.1)
  • Browser: Chrome 141.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.3
  • MU Plugins: None activated
  • Plugins:
  • Convert to Blocks 1.3.4
  • Test Reports 1.2.0
  • WordPress Importer 0.9.4

Steps tested

  1. Navigated to Plugins → Add New
  1. Searched for Convert to Blocks
  1. Verified the Live Preview button is displayed
  1. Clicked the button → redirected to Playground:
  1. https://playground.wordpress.net/?plugin=convert-to-blocks&blueprint-url=https%3A%2F%2Fwordpress.org%2Fplugins%2Fwp-json%2Fplugins%2Fv1%2Fplugin%2Fconvert-to-blocks%2Fblueprint.json%3Frev%3D3328483%26lang%3Den_US
  1. Playground loaded the plugin successfully
  1. Button did not appear for plugins without a preview link
  1. After installing, Live Preview button disappeared

Actual Results

  1. ✅ Issue resolved with patch.

Additional Notes

  • Any additional details worth mentioning.

Supplemental Artifacts

Add Inline: [Image([https://www.awesomescreenshot.com/image/57153858?key=4b25c234b928b287820d30c0a429f2a9)]]

#7 @nikunj8866
2 months ago

  • Keywords has-test-info added; needs-test-info removed

@dhruvang21 commented on PR #10200:


2 months ago
#8

@nikunj8866 Tested the PR with wordpress playground and it's working fine

Note: See TracTickets for help on using tickets.