How to remove rel=“nofollow” from feed page

雨燕双飞 提交于 2019-12-04 19:43:54

To remove nofollow from link please add the below code in your current active theme functions.php file.

The rss hook not allow to change content within tag, so create custom template for your feed.

/**
 * Deal with the custom RSS templates.
 */
function my_custom_rss() {

    if ( 'photos' === get_query_var( 'post_type' ) ) {
        get_template_part( 'feed', 'photos' );
    } else {
        get_template_part( 'feed', 'rss2' );
    }
}
remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', 'my_custom_rss', 10, 1 );

For more help see this link : Click here.

You can get the content of custom feed templates from core wordpress folder /wp-includes/feed-rss2.php

I hope it will help you.

Nilesh Patel

Take a look at the following code snippet:

global $post;
?>
<?php if ($post->ID == $pageid): ?>
<script type="text/javascript">
$("a").each(function() {
    if ($(this).attr("rel")) {
        $(this).removeAttr("rel");
    }
});
</script>
<?php endif; ?>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!