I have added a featured image column to my posts in the WP admin. This all works fine except when using the Quick Edit feature. Upon update, the column disappears, or rather isn't returned by the ajax save function. The column header remains, but the row being updated no longer has a featured image cell, resulting in a "blank" cell at the end of the row (all the default cells shifts left).
I'm unsure where to look to address this issue and haven't had any luck finding an answer.
Thanks for any help.
EDIT: Here is the code to add the custom column. The filter and action are called in the plugin's __construct
// Set featured image columns
add_filter('manage_edit-post_columns', array($this, 'set_custom_columns'));
add_action( 'manage_post_posts_custom_column', array( $this, 'set_custom_column_data' ), 10, 2 );
/**
* Function to create featured image column
* @param $columns
* @return array
*/
public function set_custom_columns($columns)
{
if ( !is_array( $columns ) ) {
$columns = array();
}
$new_columns = array();
foreach( $columns as $key => $label ) {
if ( $key == 'title' ) { // Put the Thumbnail column before the Title column
$new_columns['featured-image'] = __( 'Image', $this->plugin_slug );
}
$new_columns[$key] = $label;
}
return $new_columns;
}
/**
* Display custom column data
*/
public function set_custom_column_data( $column_name, $post_id ) {
// If featured image column and a featured image exists, display it
if ( 'featured-image' == $column_name ) {
if ( has_post_thumbnail( $post_id ) ) {
echo get_the_post_thumbnail($post_id, 'thumbnail');
}
}
}