Skip to content

Instantly share code, notes, and snippets.

@mannieschumpert
Created November 5, 2012 16:56
Show Gist options
  • Save mannieschumpert/4018296 to your computer and use it in GitHub Desktop.
Save mannieschumpert/4018296 to your computer and use it in GitHub Desktop.
Remove "Preview" button from Custom Post type edit page
// 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');
Copy link

ghost commented Jul 13, 2021

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