WordPress.org

Ready to get started?Download WordPress

Forums

Custom RSS feed goes blank (5 posts)

  1. Allen
    Member
    Posted 1 year ago #

    I'm perplexed by this problem and hope someone knows what is doing on. I have a plugin that puts out an RSS feed. But often the output is a blank page or (if you put the url for the rss feed in Firefox, it will go nowhere). To make thing simple, here is the code with some dummy rss item.

    Now, here is where it gets strange. If I take out the echo comment (done), the feed will work (but then it has the word done at the start).

    Here is a live url for this feed (without the echo of "done")

    http://www.wprssimporter.com?feed=amw

    I have no idea what is going on....can anybody help here? Thanks.

    add_action('init', 'rssmi_rss');
    
    function rssmi_rss(){
       add_feed('amw', 'get_my_feed');
    //echo "done";
    }
    
    function get_my_feed(){	
    
    header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
    
    	echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    	<rss version="0.92">
    	<channel>
    		<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
    		<link><?php bloginfo_rss('url') ?></link>
    		<description><?php bloginfo_rss('description') ?></description>
    		<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
    		<docs>http://backend.userland.com/rss092</docs>
    		<language><?php bloginfo_rss( 'language' ); ?></language>
    		<item>
    			<title>Dummy Title</title>
    			<description>The Excerpt</description>
    			<link>The Link</link>
    		</item>
    	</channel>
    	</rss>
    	<?php
    }
  2. bcworkz
    Member
    Posted 1 year ago #

    Did your plugin do a one time flush_rules() upon activation? If not that, I'm perplexed as well.

  3. Allen
    Member
    Posted 1 year ago #

    right..I tried that, but but that didn't help (thought it would as well)..just a perplexing issue.

  4. bcworkz
    Member
    Posted 1 year ago #

    Some more info, not sure if it helps or adds perplexity though, just FYI.

    I added your script to a test plugin on my local XAMPP test installation and was able to get the usual subscribe page displayed. However, something messed up the font size CSS of the backend! WTF? Once I removed the script, the fonts were back to normal. Something is not right, but it's not obvious.

    The only other thing I can think to try is adding a priority parameter to the add_action() call, either lower or much higher than the default 10.

  5. Allen
    Member
    Posted 1 year ago #

    thanks...I just tried messing with the priority parameter, but unfortunately that didn't change things..this is the strangest thing I've ever seen since coding.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags