-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Website Query API: Add import-site
and import-content
options
#610
Merged
adamziel
merged 12 commits into
WordPress:trunk
from
eliot-akira:website-query-import-parameter
Dec 11, 2023
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a3e6c7e
Website: Add query parameter "import" to install site from zip file URL
eliot-akira 20fb481
Correct types for MakeBlueprintOptions and importFile step
eliot-akira a999e37
Ensure protocol http or https for import file URL
eliot-akira a28c202
Documentation: Add option "import" to Query API page
eliot-akira 4ac98cc
Format
eliot-akira 2f3e7d6
Login with default admin user after importing site
eliot-akira f822a73
Rename query parameter `import` to `importFile`
eliot-akira 1253bb1
Implement query parameter `login` that was already documented but not…
eliot-akira 671869f
Revert "Implement query parameter `login` that was already documented…
eliot-akira bacb92e
Merge from upstream and resolve conflicts
eliot-akira 7ef8ced
Website Query API: Add option `import-site` and `import-content`
eliot-akira 0146f5f
Query API: Add note about CORS policy; Clarify that `login` accepts v…
eliot-akira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,11 +33,19 @@ You can go ahead and try it out. The Playground will automatically install the t | |
| `url` | `/wp-admin/` | Load the specified initial page displaying WordPress | | ||
| `mode` | `seamless`, `browser`, or `browser-full-screen` | Displays WordPress on a full-page or wraps it in a browser UI | | ||
| `lazy` | | Defer loading the Playground assets until someone clicks on the "Run" button | | ||
| `login` | `1` | Logs the user in as an admin | | ||
| `login` | `1` | Logs the user in as an admin. Set to `0` to not log in. | | ||
| `storage` | | Selects the storage for Playground: `none` gets erased on page refresh, `browser` is stored in the browser, and `device` is stored in the selected directory on a device. The last two protect the user from accidentally losing their work upon page refresh. | | ||
| `import-site` | | Imports site files and database from a zip file specified by URL. | | ||
| `import-content` | | Imports site content from a WXR or WXZ file specified by URL. It uses the WordPress Importer, so the default admin user must be logged in. | | ||
|
||
For example, the following code embeds a Playground with a preinstalled Gutenberg plugin, and opens the post editor: | ||
|
||
```html | ||
<iframe src="https://playground.wordpress.net/?plugin=gutenberg&url=/wp-admin/post-new.php&mode=seamless"> </iframe> | ||
``` | ||
|
||
:::info CORS policy | ||
|
||
To import files from a URL, such as a site zip package, they must be served with `Access-Control-Allow-Origin` header set. For reference, see: [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#the_http_response_headers). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lovely note, thank you @eliot-akira! ❤️ |
||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thank you @eliot-akira! I know it's not directly related to this PR, but it's such a small and useful change – let's keep it.