How to get and edit custom fields if in Quick Edit

I’ve got some custom fields that I would like a user to be able to edit in Quick Edit, I can manage the columns but I’m unable to edit them if Quick Edit is clicked current code with custom fields I’d like to be able to edit:

/* custom columns */
add_filter("manage_edit-programmes_columns", "edit_columns" );
add_action("manage_posts_custom_column", "custom_columns");

function edit_columns($columns)
{
    $columns = array(
        "cb" => "<input type="checkbox" />",
        "title" => "Schedule id",
        "programme" => "Programme",
        "channel" => "Channel", 
        "onair" => "On Air", 
        "catchup" => "Catchup", 
        "popularity" => "Popularity", 
        "onair" => "On Air", 
        "date" => "Date"
    );
    return $columns;
}

function custom_columns( $column ) {

    global $post;

    switch ( $column )
    {
        case "programme":
            echo get_post_meta($post->ID, 'Programme Name', true);
            break;
        case "channel":
            echo get_the_term_list($post->ID, 'channelnames', '', ', ', '');
            break;
        case "onair":
            echo get_post_meta($post->ID, 'Date Time Start', true);
            break;
        case "catchup":
            echo get_post_meta($post->ID, 'linktovideocatchup', true);
            break;
        case "popularity":
            echo get_post_meta($post->ID, 'popularityfig', true);
            break;
    }
}

Help very much appreciated.

2 Answers
2

A couple things,

  1. Make sure in your save_post hook you’re checking for DOING_AJAX which is used for saving in quick-edit.
  2. Check out my other question: Quick edit screen customization. The answer I received worked, but I haven’t actually implemented it into my plugin quite yet as it’s not a priority of mine yet.

Hope that helps you out. 😉

Leave a Comment