get_col( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE 'ai_seo_queue_%' OR option_name LIKE 'ai_seo_bulk_%' OR option_name LIKE '_transient_ai_seo_%' OR option_name LIKE '_transient_timeout_ai_seo_%'" ); foreach ( (array) $names as $name ) { delete_option( $name ); } // Post meta written by the plugin. Alt text itself is deliberately left in // place: it is site content now, not plugin data. foreach ( array( '_ai_seo_alt_generated', '_ai_seo_schema', '_ai_seo_tools_title', '_ai_seo_tools_description' ) as $meta_key ) { delete_post_meta_by_key( $meta_key ); } // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}ai_seo_log" ); // These hooks are scheduled with arguments, so clear them hook-wide rather // than by exact argument match. foreach ( array( 'ai_seo_tools_daily', 'ai_seo_tools_queue_tick', 'ai_seo_generate_alt_text' ) as $hook ) { wp_unschedule_hook( $hook ); } } if ( is_multisite() ) { $site_ids = get_sites( array( 'fields' => 'ids', 'number' => 0 ) ); foreach ( $site_ids as $site_id ) { switch_to_blog( (int) $site_id ); ai_seo_tools_uninstall_site(); restore_current_blog(); } } else { ai_seo_tools_uninstall_site(); }