Adding this bit of code to your theme’s functions.php file should help nofollow your ‘Previous Entries’ and ‘Next Entries’ pagination links:
1 2 3 4 5 6 | function pagination_add_nofollow($content) { return 'rel="nofollow"'; } add_filter('next_posts_link_attributes', 'pagnation_add_nofollow' ); add_filter('previous_posts_link_attributes', 'pagnation_add_nofollow' ); |
Originally I was trying to hack WordPress’s next_posts_link and previous_posts_link with a filter. I even tried targeting the next_post_link and get_next_posts_links function but nothing was working for my theme.
So I took a look in the /wp-includes/link-template.php and found out there was a next_posts_link_attributes function that’s meant to accept add-on CSS and REL attributes.
Easy enough!Similar Posts:
- BlogSense Retired Link Modifications. See WPTRafficTools.
- BlogSense Update 4.9.5.2 Files
- WordPress Automation BlogSense Adding The Date to the Post Title or Post body using a shortcode
- Import Vimeo RSS into WordPress Blog with BlogSense
- WordPress Automation BlogSense Retired Features -Theme & Plugin Loading
WordPress Tutorial Add nofollow to previous and next entry links
No comments:
Post a Comment