WordPress.org

Make WordPress Core

Ticket #47395: 47395.2.patch

File 47395.2.patch, 603 bytes (added by dkarfa, 6 months ago)

Code refactoring

  • src/wp-includes/meta.php

     
    207207        // Compare existing value to new value if no prev value given and the key exists only once.
    208208        if ( empty( $prev_value ) ) {
    209209                $old_value = get_metadata( $meta_type, $object_id, $meta_key );
    210                 if ( count( $old_value ) == 1 ) {
     210                if ( ( is_array( $old_value ) || is_object( $old_value ) ) && 1 === count( $old_value ) ) {
    211211                        if ( $old_value[0] === $meta_value ) {
    212212                                return false;
    213213                        }