• I’m writing a plugin that needs to create a custom db table upon activation. The plugin is for a multisite and because the table is needed for every single site, the plugin is network activated.

    After a new site is created, the custom db table is created and then I store a value in the options table to indicate which version the db table design is.

    However, I am seeing the following in the error_log:
    WordPress database error Table 'network.site_14_options' doesn't exist for query INSERT INTOsite_14_options(option_name,option_value,autoload) VALUES ('prefix_plugin_db_version', '2', 'yes') ON DUPLICATE KEY UPDATEoption_name= VALUES(option_name),option_value= VALUES(option_value),autoload= VALUES(autoload) made by wpmu_create_blog, wp_insert_site, do_action('wp_insert_site'), WP_Hook->do_action, WP_Hook->apply_filters, Plugin_Activator::new_blog_created, Plugin_Activator::install, Plugin_Activator::create_table, update_option, add_option

    I am using the wp_insert_site hook to create the custom db tables when a new site is created. Is this not the right hook for me to be using? Which one should I use instead?

    Thanks!

    • This topic was modified 4 years, 7 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
  • The topic ‘Multisite DB error table ‘options’ doesn’t exist’ is closed to new replies.