Is it posible only with 1 loop, to show all posts, but show first the posts in one specific tag?

The solutions i found, are using more than 1 loop.

If this is not possible, maybe if the post has a meta custom field called priority =1 , there is a solution to show this posts first.

Thank you for your help.


You can use meta key for ordering your result.

See reference from codex here.


$args = array(
   'post_type' => 'post',
   'meta_key' => 'priority',
   'orderby' => 'meta_value_num',
   'order' => 'ASC'
 $query = new WP_Query($args);

You have probably found your solutions 1000 times by now, but have you (or would you have had) considered simply using the "Sticky" post function? It's here for just that purpose ("prioritize" posts in the listing), but it only works (afaik) for posts (and not for custom post types).

In the Codex: https://codex.wordpress.org/Sticky_Posts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.