[wp-trac] [WordPress Trac] #32833: previous_post_link/next_post_link disappear when excluding by post_format

WordPress Trac noreply at wordpress.org
Sat Aug 29 01:38:20 UTC 2015

#32833: previous_post_link/next_post_link disappear when excluding by post_format
 Reporter:  markshiz                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  General                  |     Version:  4.2.2
 Severity:  normal                   |  Resolution:
 Keywords:  close reporter-feedback  |     Focuses:
Changes (by boonebgorges):

 * keywords:   => close reporter-feedback


 Hi markshiz -

 Thanks for the ticket, and sorry for the delay in responding.

 I'm not sure I totally understand what you think the incorrect behavior

 > What's strange about the above is that the query appears to be
 attempting to find the previous post based on the category taxonomy, which
 I have explicitly asked the function not to do through the query

 How have you done this? Is it because you've passed `false` to the third
 param, `$in_same_term`? If so, note that this is about specific terms, not
 entire taxonomies.

 `next_post_link()` and `previous_post_link()` each accept a fifth
 parameter `$taxonomy`. The default value of this parameter is
 `'category'`. That's why you see a `'category'` clause in the SQL query.
 So I don't think there's a bug here.

 It's hard to say what's happening in the case of the "disappearing" links.
 Looking at the SQL and the arguments you're passing to the `_post_link()`
 functions, I'd say it's because there are no posts with
 'post_type=project' on your installation that belong to any categories and
 do not belong to the 'post-format-aside' taxonomy. What is it that you
 *intend* to be doing with these links?

Ticket URL: <https://core.trac.wordpress.org/ticket/32833#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list