WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have seen on some websites that you can sort posts server-side by passing in some queries like so: domain.com/?sort=date or domain.com/?sort=name

How would I do this with WordPress posts on a page?

share|improve this question
Please consider accepting answers to questions you've posted previously or offering more details in the form of an edit explaining why current answers are insufficient. A 0% accept rate isn't very encouraging when you ask others for help ... – EAMann Dec 7 '10 at 22:02
up vote 3 down vote accepted

The display of posts is controlled by WordPress Loop. It has a lot of possible arguments, but they are rarely exposed in URL (especially if using pretty permalinks).

But it is possible to make use of arguments by manually adding them to URL.

For sorting see Orderby Parameters. Your example would be something like:

share|improve this answer
Didn't know this was possible on the public side. Can the same be done with number of posts shown? And can the two be mixed together easily, so for example sort them by date and show 20 items. – Cameron Dec 7 '10 at 23:35
Yeah, this is somewhat underknown trick. :) Arguments, related to number of posts, seem to be ignored if used this way. Most probably Loop overwrites them with blog's settings. – Rarst Dec 7 '10 at 23:51

Your Answer


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.