[wp-trac] [WordPress Trac] #35761: Add filter(s) to get_adjacent_post function to change variables further down

WordPress Trac noreply at wordpress.org
Sat Feb 6 04:17:06 UTC 2016


#35761: Add filter(s) to get_adjacent_post function to change variables further
down
---------------------------+-----------------------------
 Reporter:  briandichiara  |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Query          |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 I'm finding it incredibly difficult to sort a post type using the existing
 filters to order by custom post meta alphabetically on a single post (for
 next/previous post).

 A use case is when I have a separate field for a custom post type called
 "Last Name" where I would want my posts to display in alphabetical order
 by last name. When sorting on an archive with pre_get_posts, it's not a
 problem, however when navigating posts from the single post, there just
 doesn't appear to be a simple way to change the "next" and "previous"
 posts to maintain the same custom sort order when dealing with an
 alphabetical meta_value.

 I'm proposing adding one or two filters to the get_adjacent_post()
 function which allows the final query to be filtered, or more importantly,
 the query result to be filtered so a custom sort can be implemented.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35761>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list