WordPress Blog might be updated every day of the original article. WordPress will automatically insert a REL Tag in Category URL. Well, today I am going to share with you how to remove unnecessary Non Valid REL Tag from Category URL in WordPress.
Rel Tag is one of several MicroFormats in HTML. Th Rel is an attribute of HTML which is used by search engines to measures the relationship between the target link and the resource on which it appears but rel=”category” is nonvalid tag as per google rules so you need to remove that rel from the URL.Optimization method increases the rel attribute such as WordPress link tags adds rel = “category”.
If you use the W3 Validator to check your WordPress page, you will get the “Bad value category tag for attribute rel on element” error of category tag for attribute rel because WordPress is adding the rel=”category” tag to the link but now this tag is not valid for HTML5 W3C validator.
Let’s understand by code to solve the rel =”category” tag problem in order to adopt the W3C validator. If rel = “category” tag is not recognized by W3C HTML5 validator, no need to remove it.
1 2 3 4 5 6 7 | $text = str_replace( 'rel="category"', "", $text ); return $text; } |
You need to add above filter into your theme’s functions.php file to work.That’s it and check in your browser.I have been added this code in this blog, you can view the link to the category verify rel tag attribute. If you have another way to also welcome comments and share with us your experience.
Have you checked rel tag in your wordpress site? Have tested your site in HTML5 W3C validator and got this kind of error? Let me know in the comments!
If you find this article useful, share it with your friends!