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'm trying to get a navigation in the events of event manager

the next/previous post links work but they are ordered by creation date instead of event date.

How could it be possible to change this?

share|improve this question

The function WordPress ultimately uses for this is get_adjacent_post(), which has filters that allow you to modify the query directly. You'd have to modify the JOIN, WHERE and ORDER BY clauses to join the post meta table and order by your custom field.

Another option is the Ambrosite Next/Previous Post Link Plus plugin.

share|improve this answer
To use get_adjacent_post, you would basically need to write your own function, there is no built in way to use it. You can just copy the function from core.trac.wordpress.org/browser/tags/3.1.1/wp-includes/… and then paste that into your functions.php file? I am just learning about this myself – weston deboer Mar 17 '12 at 17:23
@westondeboer - you don't have to access the function directly, you can add your filters to it and then call next_post_link as you normally would, which will then call get_adjacent_post, applying your filters to the query. – Milo Mar 17 '12 at 17:49

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.