• Austin SEO
    • About TastyPlacement
    • TastyPlacement in the Press
    • Meet the Team
  • Blog
  • Services
    • SEO Services
      • WordPress SEO Service
      • Magento SEO Services
      • Conversion Rate Optimization
      • SEO Audit Service
      • Why Google Certification Matters
      • ChatGPT SEO & AI SEO Service
    • PPC & Google Ads
      • Google Ads & PPC Management
      • Remarketing Services
      • Display Ad Management
      • Facebook Ad Management
      • Google Ad Grants Management for Non-Profits
      • Adwords App Install Ad Management
      • Product Listing Ad Management
    • Analytics & Data
      • Analytics and Monitoring
      • Google Tag Manager Experts
      • Data Studio Development & Consulting
    • Social Media & Local Marketing
      • Social Media Marketing
      • Local SEO
    • Web Development
      • Mobile Website Design
      • WordPress Development
  • Case Studies
    • SEO Case Studies
      • SEO Case Study: We Beat Lowes, Then We Beat Home Depot
      • SEO Case Study: Total Domination in Houston for Medical Provider
    • Analytics Case Studies
      • Case Study: Updated Design Yields 43% Increase in Conversion Rate
      • Case Study: PPC Optimization Yields Tripled Conversion Rate
    • Social Media Case Studies
      • Social Media Case Study: Hundreds of New Customers From Core Facebook Campaign
  • Portfolios
    • Display Ad Portfolio
    • Design Portfolio
    • Infographic Portfolio
    • SEO Testimonials
  • Contact
    • New Customers: Get to Know Us
    • Customer Service & Support
    • Referral Program
    • SEO Training Seminars
    • Job: Paid Search/PPC/Adwords Analyst
    • Job: Local Digital Marketing Specialist
    • Job: SEO/Marketing Junior Analyst
    • Privacy Policy & Terms of Use
  • Click to open the search input field Click to open the search input field Search
  • Menu Menu

Tutorial: How to Remove link rel=’prev’ and link rel=’next’ from WordPress Head

WordPress

How to Remove link rel=’prev’ and link rel=’next’ from WordPress Head (in WP 3.0+)

WordPress, in its default state, prints a lot of excess code to the head section of webpages. One element that always annoyed me were two entries that always appeared:

<link rel='prev' title='' href='' />
<link rel='next' title='' href='' />

These entries are recommended for web usability for disabled persons–consider that before removing them. We were looking for a way to lean up our pages, though, so we thought we’d like to remove these entries. There are some outdated instructions in WP forums that will not work in WP 3.0; we tried several approaches, but nothing worked.

In your WordPress template, you’ll find your functions.php file. Open that file and enter the following line.

remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );

This “filter,” as it is called, will tell WordPress not to generate the link rel=’prev’ and link rel=’next’ lines in the WordPress head.

Just a note on why those outdated instructions wouldn’t work with WP 3.0. The filter we created instructs WP to turn off the action titled “adjacent_posts_rel_link_wp_head.” Our commands works in WP 3.0 and above because the former action prior to 3.0 was titled “adjacent_posts_rel_link.”

 

March 20, 2011/by Michael David
https://tastyplacement.com/wp-content/uploads/wp-tutorial2.jpg 384 848 Michael David https://tastyplacement.com/wp-content/uploads/tastyplacementneedssvg.svg Michael David2011-03-20 19:05:412015-11-02 17:22:01Tutorial: How to Remove link rel=’prev’ and link rel=’next’ from WordPress Head
24 replies
  1. Dennis says:
    March 24, 2011 at 6:02 am

    I put your code on my function.php
    but it did not work

    help me
    Dennis

    Reply
    • TastyPlacement (Michael) says:
      March 25, 2011 at 1:26 pm

      Well, If you aren’t running WP 3.0 or above, my code won’t work. In the last paragraph it describes the use of remove_action( ‘wp_head’, ‘adjacent_posts_rel_link’, 10, 0 ); instead…give that a try.

      Reply
      • Varsha says:
        November 1, 2017 at 6:39 am

        try this
        add_filter( ‘wpseo_next_rel_link’, ‘__return_false’ );
        add_filter( ‘wpseo_prev_rel_link’, ‘__return_false’ );

  2. Kathy says:
    November 11, 2011 at 9:39 am

    Thanks, works like a charm!

    Reply
  3. Tanja says:
    December 13, 2011 at 2:22 pm

    Thank you, thank you, thank you…!!! You a) answered a question I’ve been asking myself everytime I looked at my server logs, and b) told me how to eliminate the problem. I just didn’t understand where all those referrers to an actually totally unimportant rant I wrote came from; the post I wrote before seems to have turned into the most popular Google search result of my blog, so there were a lot of those, and I just couldn’t find it anywhere on the page until just now when I looked at the source code of the rendered page. A somewhat unexpected cause; especially since I have a hard time seeing the point of this WP function. What good does it do if there is no visible link on the page? Anyway, thanks for posting, big help!

    Reply
  4. Simon says:
    January 4, 2012 at 5:18 pm

    Worked great for me! just what I needed!

    Reply
  5. Friv says:
    July 23, 2012 at 1:37 pm

    Worked perfectly! Thank you for the tip :)

    Reply
  6. Hassan M Bashir says:
    July 29, 2012 at 2:13 am

    Worked Like Charm :) Thank you

    Reply
  7. Ben says:
    October 12, 2012 at 12:22 am

    Hey,

    Thanks for your Code, unfortunately it doesn’t work in WordPress 3.4.1 .

    Regards

    Reply
    • Michael David says:
      October 16, 2012 at 5:16 pm

      Dang, we’ll have to update this post when we get a chance, thank’s for the head’s up

      Reply
  8. JAGUELIN Francois says:
    November 1, 2012 at 6:39 pm

    Works perfectly with WP3.4.2
    Thanks!

    Reply
  9. Helmut says:
    December 2, 2012 at 9:16 am

    Hi Michael David,

    perfekt, vielen Dank für deinen Code Schnipsel, der hat mir noch gefehlt.

    Gruß
    Helmut

    Reply
    • Michael David says:
      December 25, 2012 at 2:16 pm

      My German isn’t great, but since see “perfect” and “dank” I take it that this worked for you.

      Reply
  10. Pawel says:
    December 12, 2012 at 3:46 am

    Worked perfect in my WP 3.4.2.
    I hate that ‘extra’ code that is always getting added by default. Many thanks!

    Reply
  11. Ramil says:
    January 11, 2013 at 6:50 am

    Thanks for this filter.

    Tested and work with WP 3.5.

    Reply
  12. Eric says:
    January 30, 2013 at 8:23 am

    Worked on perfect on one of my sites. Thanks!

    Reply
  13. Au says:
    April 18, 2013 at 11:43 pm

    Thanks you so much!

    Reply
  14. serezhki says:
    June 11, 2013 at 5:37 am

    Thanks, it works

    Reply
  15. Yuzz says:
    June 25, 2013 at 3:29 am

    Thank you very much!

    Reply
  16. Joze says:
    October 13, 2013 at 9:56 am

    It works , Thanks for sharing it.

    Reply
  17. Gil says:
    October 21, 2013 at 12:16 am

    Hi Michael
    Just tried your code and it worked perfectly.
    it is simpler than another function I had before

    Thanks for sharing!

    Reply
  18. John says:
    November 24, 2013 at 4:27 am

    Thanks,
    It work in WordPress 3.5.2.

    Reply
  19. magikache says:
    April 24, 2020 at 11:50 am

    thanks for the trick ! it’s work
    I need to modify in ftp because WP don’t allow any modification.
    Thanks lot

    Reply
  20. bbb says:
    November 21, 2023 at 4:21 am

    does not work on wordpress 6

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tutorials & Case Studies

  • Analytics
  • Case Studies
  • Infographics
  • Local Maps and Local Listings
  • Magento
  • Mobile SEO
  • Our Book: SEO for Wordpress
  • PPC
  • Programming & PHP
  • SEO
  • SEO Power Tools
  • SEO Resources
  • Social Media Marketing
  • Web Design
  • WordPress

Our Most Recent Tutorials & Case Studies

  • Tired of Expensive Website Uptime Monitoring Services? Build Your Own Uptime Monitor, 100% Free
  • Determining how and when Google Analytics 4 collects website event data
  • Infographic: Fonts & Colors That Drive the World’s Top Brands
  • Research Shows a 23% Divergence Between UA and GA4
  • How to Track Google Analytics Conversions on BuilderTrend’s iFrame Form

Search

Search Search

Archives & Tutorial Categories

  • Analytics
  • Case Studies
  • Infographics
  • Local Maps and Local Listings
  • Magento
  • Mobile SEO
  • Our Book: SEO for Wordpress
  • PPC
  • Programming & PHP
  • SEO
  • SEO Power Tools
  • SEO Resources
  • Social Media Marketing
  • Web Design
  • WordPress

Austin SEO Company, TastyPlacement

Click Here to Explore a Free Consultation

Our Most Popular Services

  • Austin SEO [Home]
  • WordPress SEO Service
  • PPC Management
  • Social Media Marketing
  • Analytics and Monitoring
  • Remarketing Experts
  • Conversion Rate Optimization

Let’s Talk: How to Get in Touch With Us

TastyPlacement Inc.
1214 W. 6th St. Ste 201
Austin, TX 78703
Tel: (512) 535-2492


Get Directions or Read Our Awesome Reviews on Google Maps
© Copyright - Austin SEO Company | TastyPlacement
  • Link to Facebook Link to Facebook Link to Facebook
  • Link to Instagram
  • Link to LinkedIn Link to LinkedIn Link to LinkedIn
  • Link to Pinterest
Link to: Book Excerpt: The Ultimate WordPress Robots.txt File Link to: Book Excerpt: The Ultimate WordPress Robots.txt File Book Excerpt: The Ultimate WordPress Robots.txt FileFrom the Wordpress SEO book Link to: Book Excerpt: Creating Keyword-Rich Content Link to: Book Excerpt: Creating Keyword-Rich Content From the Wordpress SEO bookBook Excerpt: Creating Keyword-Rich Content
Scroll to top Scroll to top Scroll to top