Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#39111 accepted enhancement

Don't output the adjacent posts rel link by default

Reported by: johnbillion Owned by: SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-patch
Focuses: performance Cc:

Description (last modified by johnbillion)

The query performed by get_adjacent_post() is an expensive one, and quickly becomes a performance bottleneck on sites with a large number of posts.

This function is called twice when viewing a single post in order to output the link rel='prev' and link rel='next' links, and is often one of the first things disabled by WordPress-specific hosts in order to increase site performance.

The usefulness of these tags is questionable. In addition, the links don't account for paginated posts (using <!--nextpage-->) and are therefore possibly incorrect in this situation.

/cc @joostdevalk for SEO review :-)

Change History (8)

#1 @johnbillion
3 years ago

  • Description modified (diff)

#2 @joostdevalk
3 years ago

+1 from me, it's actually a wrong use of rel=next and rel=prev that we correct in Yoast SEO.

#3 follow-up: @swissspidy
3 years ago

@joostdevalk How would correct usage look like? Only use it for paginated posts?

#4 in reply to: ↑ 3 @joostdevalk
3 years ago

Replying to swissspidy:

@joostdevalk How would correct usage look like? Only use it for paginated posts?

Yes, and for archives.

#5 @johnbillion
3 years ago

I'm sure I saw an existing ticket for adding rel links to archives but I can't find it now.

#6 @joostdevalk
3 years ago

That would be #18672

#7 @johnbillion
3 years ago

  • Keywords 2nd-opinion removed
  • Milestone changed from Awaiting Review to Future Release

@joostdevalk Do you want to get one of your folks to knock up a patch for this?

#8 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted
Note: See TracTickets for help on using tickets.