I have a question. I wrote a query to the following code:
<ul>
<?php
$current_category = get_queried_object_id();
$query = new WP_Query( array(
'post_type' => 'table_partner', // name of post type.
'tax_query' => array(
array(
'taxonomy' => 'table_partner_tax', // taxonomy name
'field' => 'term_id', // term_id, slug or name
'terms' => $current_category, // term id, term slug or term name
'order' => 'ASC',
'orderby' => 'title'
)
)
) );
while ( $query->have_posts() ) : $query->the_post();
?>
<li><a href="<?php the_permalink();?>"><?php the_title();?></a> </li>
<?php
endwhile;
wp_reset_query();
?>
</ul>
But it does not sort by name
I wrote a
var_dump($query->request)
to see what orderby is telling me
ORDER BY wp_posts.post_date DESC LIMIT 0, 12
What should I do now to prioritize that sort with the title?
I from the code snippet
function remove_query_order($order) {
remove_filter('posts_orderby','remove_query_order',PHP_INT_MAX);
return '';
}
add_filter('posts_orderby','remove_query_order',PHP_INT_MAX);
I used it but it didn’t work