WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/28/2010 07:12:05 AM (11 years ago)
Author:
dd32
Message:

Fix slashing in Custom fields values. Allow for the meta_key to be updated without changing meta_value. Use wpdb::insert in add_meta(). Fixes #12418

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r13473 r13489  
    855855            'supplemental' => array('postid' => $pid)
    856856        ) );
    857     } else {
     857    } else { // Update?
    858858        $mid = (int) array_pop(array_keys($_POST['meta']));
    859859        $key = $_POST['meta'][$mid]['key'];
     
    863863        if ( !current_user_can( 'edit_post', $meta->post_id ) )
    864864            die('-1');
    865         if ( $meta->meta_value != stripslashes($value) ) {
     865        if ( $meta->meta_value != stripslashes($value) || $meta->meta_key != stripslashes($key) ) {
    866866            if ( !$u = update_meta( $mid, $key, $value ) )
    867867                die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
Note: See TracChangeset for help on using the changeset viewer.