Austin SEO Company | TastyPlacement
Call Now: 512-535-2492
  • Austin SEO
    • TastyPlacement in the Press
    • Team
    • Our Markets
      • SEO Dallas TX
      • SEO Houston TX
      • SEO San Antonio TX
  • Blog | Tutorials
  • Services
    • Industry Specific
      • HVAC SEO & Marketing
    • Local
      • Local Directory Submission
      • Google Maps Ranking Consulting
    • Mobile
      • Mobile SEO and Digital Marketing
      • Mobile Website Design
    • Web Development
      • Ecommerce Web Dev
      • WordPress Development
    • Tracking & Analytics
      • Analytics and Monitoring
      • Web Performance Call Tracking
      • SEO Article Tracker Software
    • PPC Management
    • WordPress SEO Service
    • Infographic Development
    • Social Media Marketing
  • Case Studies & Portfolios
    • Infographic Portfolio
    • SEO Portfolio
    • SEO Testimonials
    • Design Portfolio
  • Contact TastyPlacement
    • Job: Local Digital Marketing Specialist
    • Job: Social Media Manager Trainee
    • Job: Search Marketing Trainee
    • Job: SEO and Internet Marketing Sales
    • Privacy Policy & Terms of Use
    • Google Adwords Disclosure

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

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

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.”

 

SEO, tutorial, WordPress

About the Author: Michael David


Michael David is the founder, current CEO, and lead strategist at TastyPlacement, based in Austin, Texas. He is the author of "WordPress 3.0 Search Engine Optimization" with the prestigious IT publisher, Packt Publishing. TastyPlacement performs search marketing campaigns, public relations, search engine optimization, social media consulting and online advertising for companies in a wide range of fields.

15 comments on “Tutorial: How to Remove link rel=’prev’ and link rel=’next’ from WordPress Head”

  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
  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

Leave a Reply Cancel reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blog and Tutorial Categories

  • Backlink Strategies
  • Infographics
  • Internet Marketing
  • Local Maps and Local Listings
  • Mobile SEO
  • Our Book: SEO for Wordpress
  • PHPLD
  • Portfolio
  • PPC
  • Programming & PHP
  • SEO
  • SEO Power Tools
  • SEO Resources
  • Social Media Marketing
  • Web Design
  • WordPress

Recent Posts and Tutorials

  • New Places for Business Bulk Upload Tool
  • Google Places Update: How to Find Missing Google+ Local Listings
  • New Orleans Pubcon 2013 Epic Dining Guide
  • Infographic: Fonts & Colors That Drive the World’s Top Brands
  • Infographic: Urban Mining
Call: 512.535.2492

Our Core Services

  • Austin SEO
  • Dallas SEO
  • San Antonio SEO
  • Austin PPC Management
  • WordPress SEO Service

Some Rich Snippets…

TastyPlacement

3910 S I H 35 Ste 302
Austin, Texas 78704-7424 USA
Office: (512) 535-2492

Scan Me

QR Code

Let’s Be Super Best Friends:

  • TastyPlacement on LinkedIn
  • TastyPlacement on Facebook
  • TastyPlacement on Twitter

TastyPlacement