blog_id ); } //get all the options from database $all_options = wp_load_alloptions(); $plugin_options = []; $related_meta = []; //check if PressBooks plugin is used if ((@include_once( WP_PLUGIN_DIR . '/pressbooks/pressbooks.php')) && //Checking if the plugin is active is_plugin_active('pressbooks/pressbooks.php')) { $pb = true; } else{ $pb = false; } //gather all post types, including built-in of without PressBooks if($pb){ $allPostTypes = get_post_types( array( 'public' => true, '_builtin' => false )) ; }else{ $allPostTypes = get_post_types( array( 'public' => true)) ; } $allPostTypes['site-meta'] = 'site-meta'; $allPostTypes['metadata'] = 'metadata'; //extract plugin options from all options foreach ( $all_options as $name => $value ) { if ( stristr( $name, '_properties_dis' ) || stristr( $name, 'schema_properties' ) || stristr( $name, 'schemaTypes' ) || stristr( $name, '_type_overwrite' ) || stristr($name, 'saoverwr') || stristr($name, '_checkbox') || stristr( $name, 'property_network_value' ) || $name == 'schema_locations' || $name == 'jsonld_output' || $name == 'parent_filter_settings') { $plugin_options[ $name ] = $value; } } //delete plugin options foreach ( $plugin_options as $key => $value ) { if ( get_option( $key ) || get_option($key, 'nonex') !== 'nonex') { delete_option( $key ); } } // Delete plugin related posts' meta //if blog is root, do not add blog number to table name $blog_id = $b->blog_id == 1 || $b == 1 ? '' : $b->blog_id.'_'; //DELETE query to postmeta database $wpdb->query( "DELETE FROM `".$wpdb->prefix.$blog_id."postmeta` WHERE `meta_key` LIKE 'pb%type%'"); $wpdb->query( "DELETE FROM `".$wpdb->prefix.$blog_id."postmeta` WHERE `meta_key` LIKE 'pb%vocab%'"); }