Make WordPress Core

Ticket #12203: would_be_nice_to_have_a_wildcard.diff

File would_be_nice_to_have_a_wildcard.diff, 913 bytes (added by technosailor, 15 years ago)
  • wp-includes/functions.php

     
    606606
    607607        // Get the ID, if no ID then return
    608608        // expected_slashed ($name)
    609         $option = $wpdb->get_row( "SELECT autoload FROM $wpdb->options WHERE option_name = '$name'" );
     609        $name = str_replace( '*', '%', $name );
     610       
     611        $option = $wpdb->get_row( "SELECT autoload FROM $wpdb->options WHERE option_name LIKE '$name'" );
    610612        if ( is_null($option) )
    611613                return false;
    612614        do_action( 'delete_option', $name );
    613615        // expected_slashed ($name)
    614         $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name = '$name'" );
     616        $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '$name'" );
    615617        if ( ! defined( 'WP_INSTALLING' ) ) {
    616618                if ( 'yes' == $option->autoload ) {
    617619                        $alloptions = wp_load_alloptions();