So I was digging a lot deeper into my child theme and found that I was actually the culprit… At some point early on I had written a function using pre_get_posts
to force a custom sort order on the team
custom post type. Here’s what I found hiding out:
add_action('pre_get_posts', 'gpc_agent_pre_get_posts');
function gpc_agent_pre_get_posts( $query ) {
// do not modify queries in the admin
if( is_admin() ) {
return $query;
}
// only modify queries for 'agent' post type
if( isset( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] === 'team' ) {
$query->set( 'orderby', 'meta_value' );
$query->set( 'meta_key', 'agent_last_name' );
$query->set( 'order', 'ASC' );
}
// return
return $query;
}
I’ve removed that and all is well.