get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s", 'robotstxt_map' ) ); foreach ( $mapping_ids as $mapping_id ) { // Force delete (bypass trash). wp_delete_post( $mapping_id, true ); } // Delete all plugin-specific post meta. $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '_robotstxt_docmd_%'" ); // Delete plugin options. delete_option( 'robotstxt_docmd_settings' ); // Delete transients (cached data). $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( '_transient_robotstxt_docmd_' ) . '%' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( '_transient_timeout_robotstxt_docmd_' ) . '%' ) ); // Clear all scheduled cron events for each mapping. foreach ( $mapping_ids as $mapping_id ) { $hook = 'robotstxt_docmd_sync_event'; $args = array( $mapping_id ); $timestamp = wp_next_scheduled( $hook, $args ); if ( $timestamp ) { wp_unschedule_event( $timestamp, $hook, $args ); } } // Clear notification transients. $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( '_transient_robotstxt_docmd_notification_' ) . '%' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( '_transient_timeout_robotstxt_docmd_notification_' ) . '%' ) ); // Note: We deliberately DO NOT delete the synced posts/pages themselves. // Users may want to keep the documentation even after uninstalling the plugin. } // Run uninstall. robotstxt_docmd_uninstall();