Skip to content

Add support for the WordPress.org plugin preview - #297

Merged
jeffpaul merged 11 commits into
developfrom
feature/plugin-preview
Dec 10, 2025
Merged

Add support for the WordPress.org plugin preview #297
jeffpaul merged 11 commits into
developfrom
feature/plugin-preview

Conversation

@dkotter

@dkotter dkotter commented Dec 18, 2023

Copy link
Copy Markdown
Collaborator

Description of the Change

WordPress.org recently launched support for plugin previews utilizing the WordPress Playground feature. Plugins wanting to take advantage of this need to opt in by setting up a blueprint.json file that configures how the preview should load. This PR adds in that file that does the following:

  1. Sets up an environment running PHP 7.4 (our supported minimum) and the latest version of WordPress
  2. Logs into the admin
  3. Installs and activates the plugin
  4. Sends the user to the Autoshare settings page

Note once these changes are on .org, the preview button will need to be enabled in a test state. Once verified as working, we can enable it for all users.

How to test the Change

The WordPress Playground allows you to spin up a new environment directly through the URL, by going to https://playground.wordpress.net/# and pasting your JSON config after the #. In this case, the URL should be: https://playground.wordpress.net/#{%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin/admin.php?page=autoshare-for-twitter%22,%22preferredVersions%22:{%22php%22:%227.4%22,%22wp%22:%22latest%22},%22steps%22:[{%22step%22:%22login%22},{%22step%22:%22installPlugin%22,%22pluginData%22:{%22resource%22:%22wordpress.org/plugins%22,%22slug%22:%22autoshare-for-twitter%22},%22options%22:{%22activate%22:true}}]}

Changelog Entry

Added - Support for the WordPress.org plugin preview

Credits

Props @dkotter

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dkotter dkotter added this to the 2.2.0 milestone Dec 18, 2023
@dkotter
dkotter requested a review from jeffpaul as a code owner December 18, 2023 22:29
@dkotter dkotter self-assigned this Dec 18, 2023
@jeffpaul

Copy link
Copy Markdown
Member

@dkotter @iamdharmesh I wonder if its worth trying to create test/demo credentials so folks don't have to run through that setup step in the plugin and jump right into seeing some sample posts & tweeting/posting to X/Twitter?

@dkotter

dkotter commented Dec 18, 2023

Copy link
Copy Markdown
Collaborator Author

@dkotter @iamdharmesh I wonder if its worth trying to create test/demo credentials so folks don't have to run through that setup step in the plugin and jump right into seeing some sample posts & tweeting/posting to X/Twitter?

This would be the ideal for a demo (I considered the same thing for our Apple Maps Block plugin). My main concern I came to was how do we prevent someone from taking those credentials and misusing them, since they would be easy to find if we're going to use those in our blueprint file? Or is that something that even needs to be cared about?

@jeffpaul

Copy link
Copy Markdown
Member

Yeah, I thought perhaps if WP Playground could take a secret somehow as input but as @dkotter @iamdharmesh mentioned elsewhere that could still be exported from the DB in the browser session so probably best to have folks enter their own credentials to test the plugin.

jeffpaul
jeffpaul previously approved these changes Dec 19, 2023
@iamdharmesh

Copy link
Copy Markdown
Member

Note:
Getting Fatal during connecting X/Twitter account. So, want to put this ON HOLD until we figure this out and solve it.

image

@dkotter

dkotter commented Dec 20, 2023

Copy link
Copy Markdown
Collaborator Author

Yeah, didn't fully test myself but getting the same error.

Seems the Playground environment doesn't yet support curl: WordPress/wordpress-playground#85

As such, probably not worth deploying this change yet as you can't actually fully test things until this gets resolved upstream

@jeffpaul jeffpaul modified the milestones: 2.2.0, Future Release Jan 2, 2024
@jeffpaul
jeffpaul marked this pull request as draft January 2, 2024 17:39
@dkotter
dkotter changed the base branch from trunk to develop June 24, 2025 15:24
@dkotter
dkotter dismissed jeffpaul’s stale review June 24, 2025 15:24

The base branch was changed.

@dkotter

dkotter commented Jun 24, 2025

Copy link
Copy Markdown
Collaborator Author

@iamdharmesh @jeffpaul This was waiting on WordPress/wordpress-playground#85 (comment) to be finished and sounds like that is now the case. Tested this again and I am able to successfully get past the connection step though didn't test beyond that.

@dkotter
dkotter requested a review from jeffpaul June 24, 2025 15:31
@dkotter dkotter removed the blocked label Jun 24, 2025
@dkotter
dkotter marked this pull request as ready for review June 24, 2025 15:31
@github-actions github-actions Bot added the needs:code-review This requires code review. label Jun 24, 2025
@jeffpaul

Copy link
Copy Markdown
Member

Looks like the settings page renders as I would expect. @iamdharmesh as you get to OSS time, mind confirming that valid X credentials work in the Playground environment before we merge this and enable the Live Preview on WPORG?

@iamdharmesh

Copy link
Copy Markdown
Member

Quick Update:

That initial fatal error is solved 🎉. However, I am getting CORS error while connecting X account. Will check on this further later.

image

Thanks!

@jeffpaul
jeffpaul removed their request for review July 7, 2025 13:56
@jeffpaul

jeffpaul commented Dec 9, 2025

Copy link
Copy Markdown
Member

Given we've struggled with this for so long, I'm inclined to close it out and just accept we won't have a Live Preview for this plugin. Any concerns @dkotter @iamdharmesh with that?

@dkotter

dkotter commented Dec 9, 2025

Copy link
Copy Markdown
Collaborator Author

Given we've struggled with this for so long, I'm inclined to close it out and just accept we won't have a Live Preview for this plugin. Any concerns @dkotter @iamdharmesh with that?

Honestly I'd be okay with just releasing this as-is. It doesn't work completely but it does provide a limited preview. But I'd also be okay with just closing this out as well if we decide that is better

@iamdharmesh

Copy link
Copy Markdown
Member

I am also okay with releasing this as-is. Better to have something than nothing.

@github-project-automation github-project-automation Bot moved this from Code Review to QA Testing in Open Source Practice Dec 10, 2025
@jeffpaul
jeffpaul merged commit afb7076 into develop Dec 10, 2025
14 checks passed
@jeffpaul
jeffpaul deleted the feature/plugin-preview branch December 10, 2025 15:19
@github-project-automation github-project-automation Bot moved this from QA Testing to Done in Open Source Practice Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:code-review This requires code review.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants