WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/24/2012 03:24:31 PM (9 years ago)
Author:
nacin
Message:

Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/option.php

    r19602 r20287  
    368368        return false;
    369369    do_action( 'delete_option', $option );
    370     $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = %s", $option) );
     370    $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
    371371    if ( ! defined( 'WP_INSTALLING' ) ) {
    372372        if ( 'yes' == $row->autoload ) {
     
    858858        wp_cache_delete( $cache_key, 'site-options' );
    859859
    860         $result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
     860        $result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $wpdb->siteid ) );
    861861    }
    862862
Note: See TracChangeset for help on using the changeset viewer.