WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to define a post.php for a Custom Content Type?

I am trying to remove the Permalink, the Slug and the Preview Changes Button from the edit/creation page of an item in my custom content type.

share|improve this question
up vote 1 down vote accepted

To remove Preview Button

function posttype_admin_css() {
    global $post_type;
    $post_types = array(
                        /* set post types */
    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' );

To remove slug

function vipx_remove_cpt_slug( $post_link, $post, $leavename ) {

    if ( 'post_type_name' != $post->post_type || 'publish' != $post->post_status ) {
        return $post_link;

    $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );

    return $post_link;
add_filter( 'post_type_link', 'vipx_remove_cpt_slug', 10, 3 );

Source: http://vip.wordpress.com/documentation/remove-the-slug-from-your-custom-post-type-permalinks/ http://wpsnipp.com/index.php/functions-php/hide-post-view-and-post-preview-admin-buttons/

If I understood your question correctly, here is your answer.


For example, you've a custom post type defined as book. single-book.php should be you're looking for.

share|improve this answer
The question seems to be about admin editor rather than front end template. – Rarst Mar 16 '14 at 14:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.