The following code will suppress the feed links in head, but Google will keep trying to access the feeds for a good while before it gives up.
//suppress feed links in <head>
add_action('plugins_loaded', 'bcw_remove_hooks');
function bcw_remove_hooks() {
remove_action('wp_head', 'feed_links', 2 );
remove_action('wp_head', 'feed_links_extra', 3 );
}
To stop Google from continuing to report 404 errors in the mean time, the feed links need to be working. Did you attempt to disable them or did they just stop working, possibly with the 4.7 update? If they just stopped working, it’s probably due to a plugin or theme conflict. If you have any interest in having functioning feed links (if only to quiet Google), you should do the switch to twentysixteen and deactivate all plugins routine to get them working, then reactivate one by one to find the problem plugin or theme.
You could customize your feeds so they always return something like “You’re not getting anything from this, so go away!” :>
]]>Do the feed links you spoke of occur in the head of every page? I am familiar with html headers, but not php headers.
To answer your question, no I did not try to disable them. I have no clue why there even are feed links since I have no feeds. Is there any point or use to them when I do not intend to have any RSS feeds?
If these links are not being followed by anyone but search bots, then it hardly matters that they are broken.
I think I understand the code you kindly provided; however, I do not know where to place it in my theme. I have used the “Editor” before, and I have the ability to program, but I have no fluency in php at all. Perhaps in the “header.php” file somewhere?
Thanks again for your reply and concern with my problem.
Happy New Year!
The only reason to maintain feed functionality is because adding “/feed” to a WP URL is a well known way to get a feed even if there were not links in the head section and you’re likely going to get such requests even without the links. If fixing the feeds isn’t too much hassle, I recommend fixing it just to appease Google because it’s going to keep trying to reach those links for a good while longer after the feed links are removed and report 404 errors when they can’t be found. I don’t know if these 404s affect the main site’s search ranking, it’s conceivable that many 404s affect an overall site quality factor.
Any kind of filter or action hook code like I provided can be placed in your theme’s functions.php file. Just add it to the bottom of the file. The one problem is any added code will be lost when the theme is updated. There’s two ways to protect custom code from updates. Either create a child theme or a simple plugin. Either one is fairly easy to do and well worth the effort IMO. If you have a commercial, framework based theme, it is probably taking up the child theme position already. In such cases a plugin is the only option.
Be really careful using the built in theme editor. There’s no backups and the slightest coding error could lock you out of the site. I suggest editing a local copy and uploading by FTP or the cPanel file manager. That’s also how to recover if you do get locked out.
]]>I do make daily (remote) backups so I do not lose too much work if things crash for some reason.
I appreciate the warnings and concern.
I do have a child theme. So that option is under consideration.
Peace in this new year.
]]>