Created
November 5, 2012 16:56
-
-
Save mannieschumpert/4018296 to your computer and use it in GitHub Desktop.
Remove "Preview" button from Custom Post type edit page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hide "Preview" button | |
function hide_preview_button() | |
{ | |
global $current_screen; | |
if ( 'CUSTOM_POST_TYPE' == $current_screen->post_type ) { | |
echo '<style>#preview-action,.updated a{display:none;}</style>'; | |
} | |
} | |
add_action('admin_head', 'hide_preview_button'); |
Remove the view buttons on the custom post type list, as well as the slug (which can be clicked to access the view) from the custom post type page:
<style>#preview-action, .updated a, #edit-slug-box, #the-list .row-actions .view {display: none;}</style>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some Custom Post Types aren't intended to be viewed like standard posts, and the "Preview" button can lead to user confusion. This is a way to hide it.