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' ); }