Gutenberg: Custom Post Visibility

Created on 9 Feb 2019  路  4Comments  路  Source: WordPress/gutenberg

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.

[Type] Help Request

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:

Screenshot of 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.

All 4 comments

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:

Screenshot of 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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ellatrix picture ellatrix  路  3Comments

hedgefield picture hedgefield  路  3Comments

pfefferle picture pfefferle  路  3Comments

davidsword picture davidsword  路  3Comments

spocke picture spocke  路  3Comments