Opened 8 years ago
Last modified 5 months ago
#44377 new enhancement
add filter to post_submit_meta_box() to conditionally refrain from outputting the "Visibility" fields
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | close |
| Focuses: | ui, administration | Cc: |
Description
I have a CPT that, by it's very nature, always has visibility public (not private nor password protected).
Since I don't want users selecting anything other than public, currently, I enqueue some CSS that hides the "Visibility" related fields in the "Publish" metabox on /wp-admin/post.php and /wp-admin/post-new.php, but that just seems kludgy.
Note: in case a "sneaky" user finds my CSS, unhides the fields and sets the post to be private or password protected,
I also hook into wp_insert_post_data to "correct" post_status and post_password.
It would be helpful if there were a filter in post_submit_meta_box() to control whether the "Visibility" related fields are output.
Such a filter would be similar in spirit to the view_mode_post_types filter in WP_Screen::render_view_mode() that controls whether the "View Mode" related fields are output in "Screen Options". Prior to view_mode_post_types being introduced in 4.4, I used to hide those fields via CSS when appropriate.
Hey @pbiron
7 years have passed since you asked for this.
It seems that
post_submit_meta_boxis not the most bleeding-edge thing nowadays… and I believe that things going into the Classic Editor are not the best to change at the moment. I wonder if you are still interested in this feature.Maybe this could be interesting to add to the Status section in Gutenberg, right? Maybe this could be reported upstream in the gutenberg repo
If you happen to do so, may you comment back and add the link to the ticket?