WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to insert some mysql data into every new blog that's created on my buddypress system. How can I hook up to the newly created blog data? ID, for example, would allow me to insert it right from the PHP. Is there a better way to do it?


share|improve this question
up vote 2 down vote accepted

see: How To Modify New Sub Blog Immediately When Super Administrator Creates It?

The code I wanted to post I unfortunately could not post beacause "body is limited to 30000 characters; you entered 62367" so ... the following filters are handy (from WordPressMU plugin for site admin to set defaults for new blogs, Deanna Schneider) :

function set_blog_defaults($blog_id, $user_id)
    global $wp_rewrite, $wpdb, $current_site;
            // do stuff

// When a new blog is created, set the options 
add_action('wpmu_new_blog', array(&$cets_wpmubd, 'set_blog_defaults'), 100, 2);

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.