I'm trying to sort a custom column in the admin edit screen. The column is contains an integer value (vote counts).
To generate the column I use this "standard" code:
add_filter( 'manage_edit-entries_sortable_columns', 'cutify_entries_columns_sortable' );
function cutify_entries_columns_sortable( $columns )
{
$columns['entry_vote_count'] = 'entry_vote_count';
return $columns;
}
add_filter( 'manage_entries_posts_columns', 'cutify_entries_columns_head' );
function cutify_entries_columns_head($defaults)
{
unset( $defaults['date'] );
$defaults['entry_vote_count'] = 'Votes';
return $defaults;
}
add_action('manage_entries_posts_custom_column', 'cutify_entries_columns_content', 10, 2);
function cutify_entries_columns_content($column_name, $post_ID)
{
if ($column_name == 'entry_vote_count')
{
$number = rand(1,1000);
print intVal($number);
}
}
The issue is trying to sort this column. I've read many answers here and on other sites and I do know about sorting this if the value came from post_meta, but as you can see, in this case the value comes from a return value from function call.
Is there any way of sorting a custom column not based on a post_meta value?