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.
A couple things,
save_post
hook you’re checking forDOING_AJAX
which is used for saving in quick-edit.Hope that helps you out. 😉
Saving data from Quick Edit and Bulk Edit need JavaScript helpers.
The following code comes out of a production system using the
video
custom post type before I wrote the the WordPress bulk edit plugin Custom Bulk/Quick Edit.File
quick_edit.js
File
video-quick-edit.php