Default feed not disabled with Suffusion
Wed, Feb 22, 2012 in post General Web coding default feed feedburner feed_links RSS feed suffusion themes wordpress
I switched to a new WordPress theme, Suffusion! Hooray! However, the %#&/?! default feed link is added to HTML even if disable it in Suffusion settings. Not hooray.
Digging into Suffusion code, I found suffusion_include_default_feed()
from functions/actions.php
, but it seems that it correctly does not output anything when I disable the default feed. Furthermore, the alternate feed URL actually does output my FeedBurner feed URL. So it seems Suffusion is not generating these links by itself.
Grepping around the WordPress source code (a look through the dozens of templating PHP files really makes me want to code a barebones blog myself) I finally located the culprit: feed_links()
method in wp-includes/general-template.php
. Why is this called? Where should it not be called?
It seems at least wp-includes/default-filters.php
is adding this feed_links action to wp_head. I commented it out, and what do you know, the nerve-wrecking automatic feed URLs are gone!
Just thought to share it if someone else is having the same problem. It looks like Suffusion should have the following somewhere if default feeds are disabled:
remove_action( 'wp_head', 'feed_links', 2 );
It seems Suffusion is adding a ton of actions and filters in its functions.php
, namely in function suffusion_setup_custom_actions_and_filters()
. So here’s a patch which gets rid of that default feed URL if you have chosen to disable it in Suffusion setup:
function suffusion_setup_custom_actions_and_filters() {
// Theme supports automatic feed links, which makes WordPress output default
// RSS feed links via feed_links action. Disable this if the user has explicitly
// chosen in Suffusion setup to disable those very feeds.
global $suf_custom_default_rss_enabled;
if ($suf_custom_default_rss_enabled != 'enabled') {
remove_action( 'wp_head', 'feed_links', 2 );
}
///// ACTIONS
2 comments
ducksauz:
And that’s why you shouldn’t run WordPress. It’s a painful ugly mess of spaghetti php code that’s complicated by more spaghetti code in the themes. It’s also chock full of security vulns that will get your site owned or at the least covered with blog spam.
If you want to run something simple, take a look at Nanoc or Jekyll. Static page generation is the way to go.
jokkebk:
Yea. Thanks for the links! Or I just could roll out my own – nothing quite like the “there’s already a hundred blog solutions so I’ll just make my own”. :)