The plugin generated 4 characters of unexpected output during activation. If you notice “headers already sent” messages at the time of activation

This error because empty space after or before PHP tags

<?php

?>

Advertisements

Add extra columns in WordPress admin custom post types

add_filter( ‘manage_{custom_post_type}_posts_columns’, ‘set_custom_post_type_edit_columns’ );
function set_custom_post_type_edit_columns($columns){
$columns[‘user_mail’] = __( ‘Email’, ‘your_text_domain’ );
return $columns;
}
add_action( ‘manage_{custom_post_type}_posts_custom_column’ , ‘custom_post_type_column’, 10, 2 );
function custom_post_type_column( $column, $post_id ) {
switch ( $column ) {
case ‘user_mail’ :
echo get_post_meta( $post_id , ‘user_mail’ , true );
break;
}
}