Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

does anybody know how to filter post by meta_key1 (meta_key1=something) and order by meta_key2 at the same time ?

query_posts('post_type=press_articles&posts_per_page=5&meta_key=dt_featured_press_radio&meta_value=yes&order=ASC') how add order by meta_key2 here ? thanks!

share|improve this question

1 Answer 1

WP_Query supports multiple values for the orderby argument (see the example from that link on the Codex.

I don't know if query_posts() does as well, but I suspect the pre_get_posts filter does, in which case you can replace query_posts() with that (which is the new "best practice" anyway).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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