# autoremove-attachments/trunk/uninstall.php

Autoremove Attachments, version trunk. 35 lines.

- Page: https://pluginprobe.com/plugins/autoremove-attachments/trunk/code/uninstall.php
- Raw: https://pluginprobe.com/plugins/autoremove-attachments/trunk/raw/uninstall.php
- Modified: 2022-03-26T22:30:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/autoremove-attachments/trunk/code/uninstall.php#L10-L20`.

```php
<?php
/**
 * Remove all options on uninstall
 *
 * @since   1.0.0
 * @package Autoremove_Attachments
 */

defined( 'WP_UNINSTALL_PLUGIN' ) || exit;





/**
 * Remove plugin options.
 */
if ( is_multisite() ) {
	global $wpdb;

	// phpcs:ignore
	$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );

	if ( $blogs ) {
		foreach ( $blogs as $blog ) {
			switch_to_blog( $blog['blog_id'] );

			delete_option( 'autoremove_attachments' );
		}
		restore_current_blog();
	}
} else {
	delete_option( 'autoremove_attachments' );
}

```
