user11130345
user11130345

Reputation:

Remove title from specific custom post type edit screen

I want to remove the custom post type title field from specific custom post type in WordPress My Custom post type is: post_type=dosage-details So I remove this post type title field.

Upvotes: 1

Views: 1728

Answers (2)

Kalti
Kalti

Reputation: 501

You could add the following code to your functions.php:

function remove_post_type_title() {

    remove_post_type_support( 'dosage-details', 'title' );

}

add_action( 'init', 'remove_post_type_title' );

Upvotes: 2

Angel Deykov
Angel Deykov

Reputation: 1227

You can check the post type inside the loop by using the get_post_type() So you can have something like:

//if the post type is not 'dosage-details'
if ( 'dosage-details' != get_post_type() ) {
    the_title();
}

Upvotes: 0

Related Questions