WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wpmu_create_blog() => Call to a member function init() on a non-object (3 posts)

  1. Jan K.
    Member
    Posted 2 years ago #

    Hi,

    i would like to create a new blog using my plugin.
    The following lines of code just result in "Fatal error: Call to a member function init() on a non-object in /wp-admin/includes/upgrade.php on line 293" .

    But when i look into my blog overview the new blog has been added successfully..
    After refreshing my website the error message is not visible anymore.

    $name = 'testblog';
    $title = 'this is my testblog';
    $user_id = '1';
    wpmu_create_blog($current_site->domain, $current_site->path . $name .'/', $itle, $user_id);

    So there is only an error message when wpmu_create_blog is executed.

    Do u know why? :S
    Thanks a lot!

  2. Jan K.
    Member
    Posted 2 years ago #

    upgrade.php lines 291 - 293

    if ( is_multisite() ) {
    	// Flush rules to pick up the new page.
    	$wp_rewrite->init();

    I've already written global $wp_rewrite; but it has no effect.. :S

    Any ideas?

  3. Jan K.
    Member
    Posted 2 years ago #

    $wp_rewrite = new wp_rewrite(); solves the problem..

Topic Closed

This topic has been closed to new replies.

About this Topic