• WordPress version: 3.4.2
    WordPress SEO version: 1.2.8.7

    I did this: I created a form processing class where I include the wordpress bootstrap.

    require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php');
    $wp->init();

    I expected the plugin to do this: Nothing?

    Instead it did this: Caused an error setting Globals that weren’t an object

    $GLOBALS['wp']->add_query_var( 'sitemap' );
    $GLOBALS['wp']->add_query_var( 'sitemap_n' );
    add_rewrite_rule( 'sitemap_index\.xml$', 'index.php?sitemap=1', 'top' );
    add_rewrite_rule( '([^/]+?)-sitemap([0-9]+)?\.xml$', 'index.php?sitemap=$matches[1]&sitemap_n=$matches[2]', 'top' );

    Wrapping the 2 occurrences (class-sitemaps.php and wpseo-functions.php) of that code with: if ( is_object($GLOBALS['wp']) ) { fixed the problem. Perhaps it could be done in a better way.

    http://wordpress.org/extend/plugins/wordpress-seo/

  • The topic ‘[Plugin: WordPress SEO by Yoast] WordPress SEO causes $GLOBALS error when bootstrap is added’ is closed to new replies.