I am writing a plugin for the Gutenberg editor.
I know how to use editPost()
to change e.g. some meta-values:
editPost( {
meta: {
myMeta: 'new meta value goes here'
}
} );
This is working fine.
But when I try to change the post status, e.g. I want to unpublish a post:
editPost( {
status: 'draft' // <-- this does not work
} );
There are several other functions, such as savePost()
or trashPost()
. I could not find anything to publish or unpublish a post.
How can I change the post status within a custom Gutenberg-plugin?