Sortable column with custom taxonomy in custom posts type

You are trying to sort by “x” but WordPress doesn’t know what that is. So you either need to sort by something WP understands like “title”:

$columns['MY_CUSTOM_COLUMN'] = 'title';

Otherwise you need “x” to actually do something like such:

function my_custom_query_sort( $query ) {
    if ( ! is_admin() ) {
        return;
    }

    $orderby = $query->get( 'orderby');

    if ( 'x' == $orderby ) {
        $query->set( 'orderby', 'SOMETHING CUSTOM' );
    }

}
add_action( 'pre_get_posts', 'my_custom_query_sort' );

But that’s not the only issue…You mention the column is a custom taxonomy. There isn’t any core function in WordPress to sort posts by taxonomy. Not to mention that each post could have multiple terms assigned to them.

tech