Add the query parameter redirect_to to the URL of your blog. This parameter is mandatory.
Values can be:
- last or latest – The URL will redirect1 to the latest post.
- first or oldest – The URL will redirect to the first (oldest) post.
- random – The URL will redirect to a random post.
- custom – The post will be determined according to the mandatory parameter orderby and the optional parameter order. Possible values for orderby are listed here. By default, order is “DESC” (descending – starting from the highest value, the later time or the bottom position in alphabetic order). Alternatively you can set it to “ASC” (ascending).
Obviously, the parameter “custom” lets you achieve the same as “latest”, “first” and “random”. These shortcuts exist just for convenience and readability.
Retrieving the 2nd, 3rd, etc. matching post
If you want to show the 2nd, 3rd, etc. matching post, you can use the parameter offset. The offset will be counted additionally. So “offset=1” means the 2nd post. If the offset is too high compared to the amount of matching posts, the procedure for “no posts found” will be run.
Redirect to the latest post:
Redirect to the 2nd-latest post:
Redirect to the post with the highest number of comments:
(Note: Replace everywhere “www.example.com” with your blog’s URL.)
- Technically the URL is rewritten, i.e. the browser address bar will show the new URL. ↩