• Resolved jpsingleton

    (@jpsingleton)


    I’m getting an error on my RSS feed page:

    This page contains the following errors:
    error on line 203 at column 1: Extra content at the end of the document
    Below is a rendering of the page up to the first error.

    When I examine the code, I see this error being added at the end of the code, after the closing </rss> tag:

    Warning: Cannot modify header information – headers already sent by (output started at /wp-includes/feed-rss2.php:11) in /wp-content/plugins/smarter-navigation/main.php on line 74

    The relevant line in feed-rss2.php is:

    echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>

    And looking at the plugin, it looks like that block of code is:

    public function set_cookie( $data = '' ) {
    		$data = wp_parse_args( $data, array(
    			'query' => json_encode( $GLOBALS['wp_query']->query ),
    			'url' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
    			'title' => trim( wp_title( self::SEP, false, 'left' ) ),
    		) );
    
    		foreach ( $data as $key => $value )
    			setcookie( self::get_name( $key ), $value, 0, '/' );
    	}

    The setcookie line near the bottom is line 74. Is there a way to tell it to not try to set the cookie if it’s on the RSS page? Or is something else causing the problem? I know that blank lines at the beginning or end of files can cause these types of problems, but that doesn’t seem to be the issue in this case.

    When I disable the Smarter Navigation plugin, the RSS works again.

    I really love the Smarter Navigation plugin, but I need my RSS feed to work. Any help would be much appreciated!

    Thanks.

    http://wordpress.org/plugins/smarter-navigation/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jpsingleton

    (@jpsingleton)

    Also, I’m running on WP 3.5.2.

    Thread Starter jpsingleton

    (@jpsingleton)

    I modified main.php by changing line 25 from this:

    $set_condition = !is_404();

    To this:

    $set_condition = !headers_sent();

    And everything appears to be working correctly—though I’m not sure if it’s caching cookies when a 404 page is loaded. If it is, it’s not causing me any problems thus far.

    I duplicated/renamed the plugin on my site to make sure the change doesn’t get overwritten by subsequent updates, but if you include this change (or another change that solves the problem), I would love to use the official Smarter Navigation plugin so I can benefit from whatever updates you come out with in the future.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Smarter Navigation Breaking RSS Feed’ is closed to new replies.