Skip to main content

how How can iI create blog specific database table in multi sitemultisite?

iI am creating a plugin, that supposesupposed to work on WP multi sitemultisite yesterday. I've installed WP multi sitemultisite on my server. to test things out andWhile testing I found out that register_activation_hook created 1 table on the main blog only, while iI have 2 more blogs.

Here is how iI create the tables now:

global $wpdb; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $table_name = $wpdb->prefix . "pm_services"; $table = "CREATE TABLE $table_name ( ID bigint(20) NOT NULL AUTO_INCREMENT, service_id bigint(20) NOT NULL, name varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY cuunique (`ID`) );"; dbDelta($table); 

Is there a way to creating this table for every blog on the network upon activation ?

how can i create blog specific database table in multi site?

i am creating a plugin, that suppose to work on WP multi site yesterday I've installed WP multi site on my server. to test things out and found out that register_activation_hook created 1 table on the main blog only, while i have 2 more blogs.

Here is how i create the tables now:

global $wpdb; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $table_name = $wpdb->prefix . "pm_services"; $table = "CREATE TABLE $table_name ( ID bigint(20) NOT NULL AUTO_INCREMENT, service_id bigint(20) NOT NULL, name varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY cuunique (`ID`) );"; dbDelta($table); 

Is there a way to creating this table for every blog on the network upon activation ?

How can I create blog specific database table in multisite?

I am creating a plugin, that supposed to work on WP multisite yesterday. I've installed WP multisite on my server. While testing I found out that register_activation_hook created 1 table on the main blog only, while I have 2 more blogs.

Here is how I create the tables now:

global $wpdb; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $table_name = $wpdb->prefix . "pm_services"; $table = "CREATE TABLE $table_name ( ID bigint(20) NOT NULL AUTO_INCREMENT, service_id bigint(20) NOT NULL, name varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY cuunique (`ID`) );"; dbDelta($table); 

Is there a way to creating this table for every blog on the network upon activation ?

Source Link
Neta Meta
  • 251
  • 4
  • 16

how can i create blog specific database table in multi site?

i am creating a plugin, that suppose to work on WP multi site yesterday I've installed WP multi site on my server. to test things out and found out that register_activation_hook created 1 table on the main blog only, while i have 2 more blogs.

Here is how i create the tables now:

global $wpdb; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $table_name = $wpdb->prefix . "pm_services"; $table = "CREATE TABLE $table_name ( ID bigint(20) NOT NULL AUTO_INCREMENT, service_id bigint(20) NOT NULL, name varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY cuunique (`ID`) );"; dbDelta($table); 

Is there a way to creating this table for every blog on the network upon activation ?