Is your feature request related to a problem? Please describe.
Not really. It's kind of related to custom post statuses (#3144), but that previously had an API (register_post_status()
). Custom post visibility was never apart of the WordPress PHP API.
Describe the solution you'd like
Currently, the existing Visibility options are Public, Private and Password Protected.
I would like to add a custom visibility to this list.
Describe alternatives you've considered
There doesn't appear to be a way to add a custom post visibility via Gutenberg. The visibility options are hardcoded:
https://github.com/WordPress/gutenberg/blob/94f54892c214ebd014ec126a9575b7e902198ad9/packages/editor/src/components/post-visibility/utils.js
Perhaps a filter to visibilityOptions
is enough for me to do what I need and I can handle the rest of the visibility server-side hopefully.
It looks like WordPress.com implemented their own "Post Settings" panel so they could have more control over the default "Status & Visibility" panel in Gutenberg:
https://en.support.wordpress.com/post-visibility/
https://github.com/Automattic/wp-calypso/tree/59bdfeeb97eda4266ad39410cb0a074d2c88dbc8/client/post-editor/editor-visibility
I previously wrote a hacky JS solution for the Classic Editor, which injects my custom visibility and listens to the select dropdown option to make my changes, but would love a proper API.
Hi there!
You should be able to add your own panel to the Document Settings or to a custom sidebar.
This tutorial should help (just notice that this tutorial uses the sidebar slot, you can use the PostPublishStatus info slot
https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/plugin-sidebar-0/
Good luck.
Sorry for the late reply as I'm just getting to this.
I don't want to add my own panel to the "Document Settings" block. I want to modify the existing "Visibility" options:
It's not currently possible to do that as I listed in my description. Please consider adding the possibility for developers to modify these options.
Have some awser to this?
I'd love to change those labels
Most helpful comment
Sorry for the late reply as I'm just getting to this.
I don't want to add my own panel to the "Document Settings" block. I want to modify the existing "Visibility" options:
It's not currently possible to do that as I listed in my description. Please consider adding the possibility for developers to modify these options.