Open adamziel opened 12 months ago
Instead of doing a wp_insert_post
, I did a wp_update_post
. Since I know that post ID 2 exists, I updated it with my content and made it my landing page:
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "\/wp-admin\/post.php?post=2&action=edit",
"preferredVersions": {
"php": "8.1",
"wp": "latest"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"features": {
"networking": true
},
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org\/plugins",
"slug": "jobbnorge-block"
},
"options": {
"activate": true
}
},
{
"step": "runPHP",
"code": "<?php require '/wordpress/wp-load.php'; wp_update_post( array('ID' => 2, 'post_title' => 'Jobbnorge','post_content' => '<!-- wp:dss/jobbnorge {\"employerID\":\"1981,1992,1980,2770,1989,1994,1986,1984,1985,1987,1996,1988,1982,1983,1995,1993,1991\"} /-->' ) );"
}
]
}
You can test it at https://wordpress.org/plugins/jobbnorge-block/
Nice! Thank you so much for sharing @soderlind!
There is no convenient way of creating a post inside of a Blueprint and then redirecting the user to the post editor with that post opened.
For example, the Blueprint in block-development-examples#75 had to rely on a hardcoded post ID:
Let's add support for that. How? I'm not sure at this point – it will take some discussions and explorations.
Done is
FYI @dawidurbanski