问题
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
回答1:
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.
回答2:
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; ?>
来源:https://stackoverflow.com/questions/51649179/how-to-remove-rel-nofollow-from-feed-page