Comment List Columns

function add_comment_columns($columns){
return array_merge($columns,array('metafield_name' => __('Meta 1'),'metafield_name2' => __('Meta 2')));
}
add_filter('manage_edit-comments_columns','add_comment_columns');

function add_comment_column_data($column,$comment_ID){
switch($column){
case 'metafield_name':
if($meta = get_comment_meta($comment_ID,$column,true)) echo $meta;
break;
case 'metafield_name2':
if($meta = get_comment_meta($comment_ID,$column,true)) echo $meta;
break;
default:
return;
}
}
add_filter('manage_comments_custom_column','add_comment_column_data',10,2);

?>

0 Comments

You must be logged in to post a comment.