Make WordPress Core

Opened 12 years ago

Closed 10 years ago

#22406 closed defect (bug) (fixed)

adjacent_posts_rel_link ignores $excluded_categories argument

Reported by: adelval's profile adelval Owned by: nacin's profile nacin
Milestone: 3.9 Priority: normal
Severity: normal Version: 2.8
Component: Posts, Post Types Keywords: has-patch
Focuses: template Cc:


The ticket subject is pretty obvious, I think, just by looking at the source in link-template.php:

function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
    echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);
    echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);

The $excluded_categories should be passed to get_adjacent_post_rel_link just as they come, not as an empty string.

Possible use cases of having the bug fixed:

  • want to exclude a category from almost everywhere (because it has a single place in the blog), but it keeps appearing in the rel links.
  • don't want to help robots discover posts from those categories through the rel links (robots.txt is not enforceable).

Attachments (1)

22406.patch (1.6 KB) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Template
  • Keywords has-patch added; needs-patch removed
  • Version changed from 3.4.2 to 2.8

Introduced in [10815] along with the function itself.

next_post_rel_link() and prev_post_rel_link() are also affected.

#2 @nacin
10 years ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added
  • Milestone changed from Awaiting Review to 3.9

Let's fix this. Oops!

#3 @nacin
10 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 27754:

Fix excluded_terms passed to get_adjacent_posts_rel_link().

props adelval.
fixes #22406.

Note: See TracTickets for help on using tickets.