Forums

XML Sitemap & Google News Feeds
[Plugin: XML & Google News Sitemap Feeds] Fatal Error: multi site (3 posts)

  1. troykd
    Member
    Posted 10 months ago #

    We get this a lot on load and it goes away on refresh:

    Fatal error: Call to a member function flush_rules() on a non-object in /home/oursite/public_html/wp-content/plugins/xml-sitemap-feed/XMLSitemapFeed.class.php on line 199

    http://wordpress.org/extend/plugins/xml-sitemap-feed/

  2. RavanH
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Troy, I've seen a report about this error before but cannot reproduce it.

    The line (199) the error refers to should only be run after the plugin has been upgraded. Do you see the error one time after plugin upgrade and after that no more? Or after any other plugin upgrade? Or do you see the error all the time?

    Hope you can tell me more so I can get closer to the root of it :)

  3. RavanH
    Member
    Plugin Author

    Posted 10 months ago #

    UPDATE:

    Could you try this for me? Open the plugin file XMLSitemapFeed.class.php in the WordPress plugin editor and find these lines near the end

    ...
    		// FLUSH RULES after (site wide) plugin upgrade
    		if (get_option('xml-sitemap-feed-version') != XMLSF_VERSION) {
    			update_option('xml-sitemap-feed-version', XMLSF_VERSION);
    			global $wp_rewrite;
    			$wp_rewrite->flush_rules();
    			// TODO fix PHP Fatal error:Call to a member function flush_rules() on a non-object in /var/www/wordpress/wp-content/plugins/xml-sitemap-feed/XMLSitemapFeed.class.php after (any?) plugin upgrade
    		}
    ...

    Now replace the two lines

    global $wp_rewrite;
    $wp_rewrite->flush_rules();

    with this one line

    add_action('init', 'flush_rewrite_rules');

    And to test if it does not generate an error on upgrade, open the file xml-sitemap.php and change the value for define('XMLSF_VERSION', '3.9.2'); to define('XMLSF_VERSION', '3.9.2.1'); for example. Then refresh your sites front page and check the logs again.

Reply

You must log in to post.

About this Plugin

About this Topic