I want to have a column (e.g Send Email) in my custom posts (books) list. In each row there should be a button (Send) and when I click on it I want to send an email.

I have seen is a hook manage_posts_custom_column to add custom column but this hook only adds post meta as columns like featured image etc.

How to do this, please help me.


enter image description here

1 Answer 1


Adding A New Column To The books Post Table

Here we can use the filters


or for the books post type:


Here's an example how we could display a button, for each row in the send_email column:

 * Books Post Table: Display a utton in each row in the 'send_email' column
add_action( 'manage_books_posts_custom_column', function ( $column_name, $post_id ) 
    if ( $column_name == 'send_email')
        printf( '<input type="button" value="%s" />', esc_attr( __( 'Send Email' ) ) );

}, 10, 2 );

To add the send_email column we can use:

 * Books Post Table: Add the 'send_email' column
add_filter('manage_books_posts_columns', function ( $columns ) 
    if( is_array( $columns ) && ! isset( $columns['send_email'] ) )
        $columns['send_email'] = __( 'Send Email' );     
    return $columns;
} );

We could also limit the column width with:

 * Limit the 'send_email' column width
add_action( 'admin_print_styles-edit.php', function()
    echo '<style> .column-send_email { width: 100px; }</style>';
} );

Here's an example output:


You will then have to implement how the button will work.

ps: I removed the second part from my answer, since that part of your question, would be better served as a new separate question.

  • First of all thanks for your answer friend. 1) Button successfully added :) can you please also let me know how to keep it at right side with equal to button width only, I have attached screenshot for better understanding. 2) Second answer is not exactly clear, I do not want to remove Draft , I want to remove "- post_status", see screenshot. Mar 9, 2016 at 11:20
  • Looks like your part #2 regarding post status has been solved. I added a hack to adjust the column width. @BhuvneshGupta
    – birgire
    Mar 9, 2016 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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