Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

cfetr on "edit-tag.php Sortable Column not sorting correctly"

$
0
0

Greetings everyone!

I have used the article over at scribu to add and make a column sortable for a taxonomy. The field is an int in the database and is sorted using meta_value_num ( also tried 'meta_value meta_value_num' and reversed). The problem arises when trying to sort the list on the column. My custom column is always sorted alphabetically by title even though I have chosen my column to sort on. Thanks for any help!

function term_order_column_orderby( $vars ) {
    if ( isset( $vars['orderby'] ) && 'term_order' == $vars['orderby'] ) {
        $vars = array_merge( $vars, array(
            'meta_key' => 'term_order',
            'orderby' => 'meta_value_num'
        ) );
    }

    return $vars;
	}
add_filter( 'request', 'term_order_column_orderby' );

Viewing all articles
Browse latest Browse all 8245

Trending Articles