WordPress.org

Ready to get started?Download WordPress

Forums

Update current user's primary blog after creating a blog in wordpress multisite (1 post)

  1. chibib0
    Member
    Posted 2 years ago #

    I wanted to update the current user's primary blog to the blog created after blog signup on wp-signup.php form. So that the current user's primary blog is set to the blog he had created.

    I tried this but its not working,

    add_action('wpmu_new_blog','update_primary_blog',10);
    
        function update_primary_blog() {
        global $wpdb;
        update_user_meta( get_current_user_id(), 'primary_blog', $wpdb->insert_id );
        }

    Is there another way to do it?

Topic Closed

This topic has been closed to new replies.

About this Topic