WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have picked through Scribu's post very carefully and cannot determine where the issue is.

Here is the code:

// Register the column
function event_date_column_register( $columns ) {
$columns['event-date'] = __( 'Event Date', 'my-plugin' );

return $columns;
add_filter( 'manage_edit-event_columns', 'event_date_column_register' );

// Display the column content
function event_date_column_display( $column_name, $post_id ) {
if ( 'event-date' != $column_name )

$event_date = get_post_meta($post_id, 'event-date', true);
if ( !$event_date )
    $event_date = '<em>' . __( 'undefined', 'my-plugin' ) . '</em>';

echo $event_date;
add_action( 'manage_event_custom_column', 'event_date_column_display', 10, 2 );

// Register the column as sortable
function event_date_column_register_sortable( $columns ) {
$columns['event-date'] = 'event-date';

return $columns;
add_filter( 'manage_edit-event_sortable_columns', 'event_date_column_register_sortable' );

function event_date_column_orderby( $vars ) {
if ( isset( $vars['orderby'] ) && 'event-date' == $vars['orderby'] ) {
    $vars = array_merge( $vars, array(
        'meta_key' => 'event-date',
        'orderby' => 'meta_value',
        'order'     => 'asc'
    ) );

return $vars;
add_filter( 'request', 'event_date_column_orderby' );

I have a custom post type for Event with a custom field: event-date dates are entered: 2011/06/21

Is this something stupid I have missed or this won't do what I want? It does put the heading up at the top of the admin events list but nothing shows in each line item.

share|improve this question
up vote 3 down vote accepted

i believe the right hook for displaying the actual column content (each line) is


so change in your code:

add_action( 'manage_event_custom_column', 'event_date_column_display', 10, 2 );


add_action( 'manage_event_posts_custom_column', 'event_date_column_display', 10, 2 );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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