How to remove rel=“nofollow” from feed page

2019-04-16 12:59发布

In this page every link has rel="nofollow".

can you guys please tell me how to remove the nofollow from that page.

I am using WordPress them.

Hoping to receive some help from your side

Thanks in advance

2条回答
姐就是有狂的资本
2楼-- · 2019-04-16 13:59

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; ?>
查看更多
欢心
3楼-- · 2019-04-16 14:01

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.

查看更多
登录 后发表回答