Opened 7 years 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: | Posts, Post Types | Keywords: | |
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.