prefix . 'wppa_path_redirects'; // Plugin-owned table; the name is $wpdb->prefix plus a literal and DDL has no prepared form. $wpdb->query( "DROP TABLE IF EXISTS {$wppa_table}" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL, PluginCheck.Security.DirectDB.UnescapedDBParameter delete_option( 'wp_pro_admin_redirect_schema' ); $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_wppa_live_draft_of' ), array( '%s' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery // Retained previous versions of replaced media. The files themselves are left on disk on // purpose: deleting user uploads during an uninstall is not this plugin's call to make. $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_wppa_replaced_file' ), array( '%s' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery wp_clear_scheduled_hook( 'wp_pro_admin_cleanup_replaced_media' ); } // Everything above is per-site — the option, the table prefix and the meta table all differ per // blog — so on multisite every site gets the full clean, not just the option. if ( is_multisite() ) { $wppa_site_ids = get_sites( array( 'fields' => 'ids', 'number' => 0, 'update_site_meta_cache' => false, ) ); foreach ( $wppa_site_ids as $wppa_site_id ) { switch_to_blog( $wppa_site_id ); wppa_uninstall_current_site(); restore_current_blog(); } } else { wppa_uninstall_current_site(); }