admin管理员组文章数量:1389960
I am currently working on the completion of a custom template and my last hurdle is to be able to remove the comments feed link being added to the head of the page.
For example: in firefox when you open any of the pages on my site there is an rss icon, when clicked I am shown 3 options to add to my reader but the last two are related to comments.
The culprits are located in the
<link rel="alternate" type="application/rss+xml" title="Example Title » Comments Feed" href="" />
<link rel="alternate" type="application/rss+xml" title="Example Title » Home Page Comments Feed" href="" />
I wish to have the main feed, which contains blog posts from the blog area of the site but do not want any comments, therefore comment feeds are useless to me!
I am wondering if there is a way I can remove these via the functions.php or some way through wordpress rather than coming up with another (messier) solution?
Thanks, Tristan
I am currently working on the completion of a custom template and my last hurdle is to be able to remove the comments feed link being added to the head of the page.
For example: in firefox when you open any of the pages on my site there is an rss icon, when clicked I am shown 3 options to add to my reader but the last two are related to comments.
The culprits are located in the
<link rel="alternate" type="application/rss+xml" title="Example Title » Comments Feed" href="http://example/comments/feed" />
<link rel="alternate" type="application/rss+xml" title="Example Title » Home Page Comments Feed" href="http://example/home-page/feed" />
I wish to have the main feed, which contains blog posts from the blog area of the site but do not want any comments, therefore comment feeds are useless to me!
I am wondering if there is a way I can remove these via the functions.php or some way through wordpress rather than coming up with another (messier) solution?
Thanks, Tristan
Share Improve this question asked Jan 7, 2011 at 12:45 TGuimondTGuimond 1552 silver badges9 bronze badges 2- Related: wordpress.stackexchange/questions/126174/… – jerclarke Commented Mar 21, 2020 at 0:09
- Related: How to disable the comments feed entirely with wp_die(): wordpress.stackexchange/questions/45941/… – jerclarke Commented Mar 21, 2020 at 0:56
3 Answers
Reset to default 2Add this to functions.php
add_filter('post_comments_feed_link', '__return_null');
This is what most plugins and devs use:
remove_action( 'wp_head', 'feed_links_extra', 3);
Add it in your theme's functions.php (before the last ?>
if you don't know what you are doing).
None of the above solutions worked for me on Wordpress 3.3.2.
In a category page, for example I had:
application/rss+xml" title="title feed" href="http://www.example/feed/" />
application/rss+xml" title="Title Comments Feed" href="http://www.example/comments/feed/" />
application/rss+xml" title="Title Category Feed" href="http://www.example/cat/feed/" />
To remove the first and the second line (main feed and comments feed), I'v haded the following code to /wp-content/themes/my-theme-name/functions.php
remove_action('wp_head', 'feed_links', 2);
add_action('wp_head', 'my_feed_links');
On main page none of those will be displayed.
本文标签: phpDisable comment rss feeds for pages in wordpress
版权声明:本文标题:php - Disable comment rss feeds for pages in wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744608878a2615528.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论