WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
WordPress SEO causes $GLOBALS error when bootstrap is added (1 post)

  1. mikevoermans
    Member
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic