elin-r
10/4/2016 - 9:23 AM

WP Remove Preview Button for Custom Post Types

WP Remove Preview Button for Custom Post Types

function posttype_admin_css() {
    global $post_type;
    $post_types = array(
                        /* set post types */
                        'saljbrev',
                  );
    if(in_array($post_type, $post_types))
    echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
}

add_action( 'admin_head-post-new.php', 'posttype_admin_css' );
add_action( 'admin_head-post.php', 'posttype_admin_css' );