[wp-trac] [WordPress Trac] #63420: update_metadata issue when checking $wpdb->update result
WordPress Trac
noreply at wordpress.org
Thu May 8 23:30:22 UTC 2025
#63420: update_metadata issue when checking $wpdb->update result
--------------------------------+---------------------------------------
Reporter: gdogabriel | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses: administration, rest-api
--------------------------------+---------------------------------------
Comment (by gdogabriel):
Perhaps the suggestion above could be problematic, since per function
documentation it’s expected that failing or the value is the same to
return false, and other areas may rely on this.
> The new meta field ID if a field with the given key didn't exist and was
therefore added, true on successful update, false on failure or if the
value passed to the function is the same as the one that is already in the
database.
So a second line of thought is to try to fix the update_meta_value
function in wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
We need to figure out why the code below is not working to detect when
value is the same:
{{{#!php
<?php
if ( is_array( $old_value ) && 1 === count( $old_value )
&& $this->is_meta_value_same_as_stored_value(
$meta_key, $subtype, $old_value[0], $value )
) {
return true;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63420#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list