WordPress.org

Make WordPress Core

Ticket #12203: would_be_nice_to_have_a_wildcard-2.diff

File would_be_nice_to_have_a_wildcard-2.diff, 663 bytes (added by technosailor, 8 years ago)

To avoid risk of someone pulling the proverbial rm -rf /, try patch 2 on for size.

  • wp-includes/functions.php

     
    627627        return true;
    628628}
    629629
     630function delete_bulk_options( $name )
     631{
     632        global $wpdb;
     633       
     634        wp_protect_special_option( $name )
     635       
     636                $options = $wpdb->get_row( "SELECT autoload FROM $wpdb->options WHERE option_name LIKE '$name'" );
     637                if ( is_null($options) )
     638                        return false;
     639                       
     640                foreach( $options as $option )
     641                {
     642                        delete_option( $option );
     643                }
     644               
     645        do_action( 'delete_bulk_options', $name );
     646        return true;
     647}
     648
    630649/**
    631650 * Delete a transient
    632651 *