#39111 closed enhancement (fixed)
Don't output the adjacent posts rel link by default
Reported by: | johnbillion | Owned by: | johnbillion |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch needs-testing dev-feedback |
Focuses: | performance | Cc: |
Description (last modified by )
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 :-)
Attachments (1)
Change History (17)
#3
follow-up:
↓ 4
@
8 years ago
@joostdevalk How would correct usage look like? Only use it for paginated posts?
#4
in reply to:
↑ 3
@
8 years ago
Replying to swissspidy:
@joostdevalk How would correct usage look like? Only use it for paginated posts?
Yes, and for archives.
#5
@
8 years ago
I'm sure I saw an existing ticket for adding rel links to archives but I can't find it now.
#7
@
7 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?
#9
@
5 years ago
- Milestone changed from Future Release to 5.5
- Owner changed from SergeyBiryukov to johnbillion
#10
@
5 years ago
- Keywords has-patch needs-testing added; needs-patch removed
39111.diff removes the rel links but notably the number of database queries on the page doesn't get reduced if you use one of the default themes because they all include previous/next post links which uses the same query. If you use a theme which doesn't display previous/next post links on the page, then this provides the performance benefit as mentioned in the summary in addition to removing these tags which are unnecessary from an SEO perspective.
#11
@
4 years ago
- Keywords dev-feedback added
- Milestone changed from 5.5 to Future Release
- Owner johnbillion deleted
- Status changed from accepted to assigned
#12
@
4 years ago
- Milestone changed from Future Release to 5.6
- Owner set to johnbillion
- Status changed from assigned to accepted
#14
@
4 years ago
Should the adjacent_posts_rel_link_wp_head
function be marked as deprecated also? I don't see that it's used anywhere else.
Also just a note for others following this ticket, enabling memcached or another object caching solution will help this performance issue significantly, since the get_adjacent_post
function uses wp_cache_set
and wp_cache_get
appropriately.
+1 from me, it's actually a wrong use of rel=next and rel=prev that we correct in Yoast SEO.