Question

I am trying to set a Post's default visibility to 'Private' when a user first creates the post. They should then have the ability to manually select 'published' from the sidebar dropdown once they are ready or the post has been reviewed.

My goal is to ensure posts aren't accidentally published if the user isn't ready or forgot to select 'private'.

I can't find any code that works for Gutenberg. Most I researched are outdated and for the classic editor. I would prefer not to use a plugin if possible.

Any help is much appreciated. Thanks in advance!

Was it helpful?

Solution

At the time of writing, there are no filters on the initial edits array passed from PHP through to javascript and into the editor initialisation function.

If such a filter existed, it would be possible to apply a post_status field, but no PHP or JS hooks exist currently to do this.

The Editor component also provides no opportunities to modify this structure to add/edit values.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top