Support » Plugin: HyperDB » Multisite blog tables

  • Gronix

    (@gronix)


    Hello!

    Multisite blog tables are “{$base_prefix}{$blog_id}_*” so I have past

    $wpdb->add_callback('my_db_callback');
    function my_db_callback($query, $wpdb) {
    if ( preg_match("/^{$wpdb->base_prefix}{$blog_id}\d+_/i", $wpdb->table) )
    return 'blog';
    }

    or

    $wpdb->add_callback('my_db_callback');
    function my_db_callback($query, $wpdb) {
    if ( preg_match("/^{$wpdb->base_prefix}{$blog_id}_*\d+_/i", $wpdb->table) )
    return 'blog';
    }

    ?

Viewing 1 replies (of 1 total)
  • Plugin Author Barry

    (@barry)

    How about this?


    if ( preg_match('/^' . $wpdb->base_prefix . '\d+_/i', $wpdb->table ) )
    return 'blog';

Viewing 1 replies (of 1 total)
  • The topic ‘Multisite blog tables’ is closed to new replies.