query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '\\_ariseo\\_%'" ); $ariseo_cleaned = false !== $wpdb->query( "DELETE FROM {$wpdb->termmeta} WHERE meta_key LIKE '\\_ariseo\\_%'" ) && $ariseo_cleaned; $ariseo_cleaned = false !== $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '\\_transient\\_ariseo\\_%' OR option_name LIKE '\\_transient\\_timeout\\_ariseo\\_%'" ) && $ariseo_cleaned; foreach ( array( 'ariseo_redirects', 'ariseo_404' ) as $ariseo_table ) { $ariseo_cleaned = false !== $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS %i', $wpdb->prefix . $ariseo_table ) ) && $ariseo_cleaned; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- removing our own tables. } // phpcs:enable wp_clear_scheduled_hook( 'ariseo_indexnow_send' ); wp_clear_scheduled_hook( 'ariseo_prune_404' ); foreach ( array( 'ariseo_sitemap_version', 'ariseo_imported', 'ariseo_indexnow_queue', 'ariseo_indexnow_log', 'ariseo_indexnow_tries', 'ariseo_indexnow_lock', 'ariseo_flush_rules', 'ariseo_rules_sig', 'ariseo_db_version', 'ariseo_redirect_index', 'ariseo_deleted_urls', 'ariseo_setup_done', 'ariseo_ml_seeded', 'ariseo_canon_cleanup', 'ariseo_audit_run', 'ariseo_audit_result' ) as $ariseo_option ) { delete_option( $ariseo_option ); } // If a delete failed, keep the settings (with the delete choice) so reinstalling and // deleting AriSEO again finishes the cleanup instead of leaving orphaned data behind. if ( $ariseo_cleaned ) { delete_option( 'ariseo_settings' ); }