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 want to hook a function upon activation of a blog in wordpress multisite.

I have this,

add_filter( 'add_signup_meta', 'custom_add_signup_meta' );

function custom_add_signup_meta ( $blogmeta = array() ) {

        $the_country = $_POST['country-origin'];
        $d_currency = $_POST['user_currency'];
        $d_zone = $_POST['state-origin'];

        $blogmeta['countries_id'] = $the_country;
        $blogmeta['default_currency'] = $d_currency;
        $blogmeta['zone_id'] = $d_zone;

    return $blogmeta;


add_action( 'wpmu_activate_blog', 'insert_custom_datas1', 10, 3 );

function insert_custom_datas1($blog_id, $blogmeta) {
        global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
        $wp_blogs = $wpdb->base_prefix . "blogs";

        $wpdb->query("UPDATE `" . $wp_blogs . "` SET `countries_id`='".$wpdb->escape($blogmeta['countries_id'])."', `default_currency`='".$wpdb->escape($blogmeta['default_currency'])."', `zone_id`='".$wpdb->escape($blogmeta['zone_id'])."' where `blog_id` = '" . (int)$blog_id . "'");


However, its not working.. what suppose to be the problem? Thanks.

share|improve this question
up vote 0 down vote accepted

There are two possible causes I can think of:

  1. The 'wpmu_activate_blog' hook supplies 5 arguments ($blog_id, $user_id, $password, $signup->title, $meta), but you're only receiving 2 parameters ($blog_id, $blogmeta)

  2. The 'wpmu_activate_blog' hook is only triggered when a user creates a blog and not when the super adimin creates one.

share|improve this answer
Where should i hook the function for all signups? – Ken Jul 23 '12 at 6:06

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.