Vivek Tamrakar
Vivek Tamrakar

Reputation: 522

How to remove title post description in post type column name from admin panel

enter image description here

I want only to remove description from title how to do

Upvotes: 0

Views: 1432

Answers (2)

Maxim
Maxim

Reputation: 1

add_filter( 'get_the_excerpt', function ( $post_excerpt, $post ){
            global $pagenow;

            $custom_post_type = 'my_custom_post_type';

            if($post->post_type == $custom_post_type && $pagenow == 'edit.php'){
                return '';
            }else{
                return $post_excerpt;
            }
        }, 10, 2 );

Replace 'my_custom_post_type' with your post type

Upvotes: 0

Ankur Bhadania
Ankur Bhadania

Reputation: 4148

The hooks to create custom columns and their associated data for a custom post type are manage_{$post_type}_posts_columns and manage_{$post_type}_posts_custom_column respectively, where {$post_type} is the name of the custom post type.

Here is example

Override your columns values using manage_{$post_type}_posts_custom_column

add_action( 'manage_{$post_type}_posts_custom_column' , 'custom_cpost_column', 99, 2 );
function custom_cpost_column( $column, $post_id ) {
    switch ( $column ) {

        case 'new-title'//new-title=your column slug :
            echo get_the_title( $post_id  );
            break;
    }
}

Upvotes: 1

Related Questions