All Topics
Sorting in custom column not working fine
Hi,
I created a custom column to show the last modified date of a post,
My get_raw_value function looks like this:
public function get_raw_value( $post_id ) {
$m_orig = get_post_field( 'post_modified', $post_id, 'raw' );
$m_stamp = strtotime( $m_orig );
$value = date('n/j/y @ g:i a', $m_stamp );
return $value;
}
I add the column in settings and I enabled the sort, however in All Post the column is not sorting correctly. I have data from 2015 and 2011, of course if I sort ASC the 2011 need to show up at the top and same when order DESC, 2015 should go to the top, but it brings me 2014 first.
Please advice.