For some reason, I need a slight change in the URLs that go out with the RSS feed of my WP-powered blog. Currently, the permalinks look like this:
http://www.thesite.com/blogs/post_title
This is the URL that's going into my RSS feed (a custom feed I built) as well. However, I need the URL to go with blog instead of blogs:
http://www.thesite.com/blog/post_title
To that end, this is what I tried using the str_replace()
function with WP's the_permalink_rss()
in my custom feed PHP (rss-burrofeed.php) code and here's the snippet illustrating this hack in context:
<item>
<title><?php the_title_rss(); ?></title>
<link><?php str_replace('/blogs/','/blog/',the_permalink()); ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author(); ?></dc:creator>
<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
<?php rss_enclosure(); ?>
<?php do_action('rss2_item'); ?>
</item>
But this is not working. The links are still appearing with blogs and not blog. Am I doing something wrong? Why isn't str_replace()
working?