fix: correct class-psa-search.php blob (was truncated in chunked upload)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-08 17:44:57 +07:00
commit 8fe543b726
18 changed files with 2605 additions and 0 deletions

39
uninstall.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
/**
* Fired when the plugin is uninstalled.
*
* Cleans up all plugin data: peptide posts, post meta, options, transients, and rewrite rules.
*
* @package PeptideSearchAI
*/
// Abort if not called by WordPress.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
// 1. Delete all peptide custom posts and their meta.
$peptide_ids = $wpdb->get_col(
"SELECT ID FROM {$wpdb->posts} WHERE post_type = 'peptide'"
);
if ( ! empty( $peptide_ids ) ) {
foreach ( $peptide_ids as $post_id ) {
wp_delete_post( (int) $post_id, true ); // Force delete, bypass trash.
}
}
// 2. Delete plugin options.
delete_option( 'psa_settings' );
// 3. Delete all plugin transients (validation cache, rate limits).
$wpdb->query(
"DELETE FROM {$wpdb->options}
WHERE option_name LIKE '_transient_psa_%'
OR option_name LIKE '_transient_timeout_psa_%'"
);
// 4. Flush rewrite rules to clean up the peptide post type permalinks.
flush_rewrite_rules();