Question

is it possible to query posts ordering them by date, but also give priority for a specific term? I want posts from this term to be always on top, followed by the posts of the other taxonomies.

$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    $query_args = array(
    'post_type' => 'topics',
    'posts_per_page' => 12,
    'paged' => $paged,
);
$query = new WP_Query($query_args);
if($query -> have_posts()):while($query -> have_posts()):$query -> the_post();
Was it helpful?

Solution

There are no default sorting to show a specific term posts on top of others. So need some tricks to achieve it. You can check this answer, should be helpful. https://wordpress.stackexchange.com/a/161168/102213

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top