Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Post_Model::is_meta_value_same_as_stored_value( string $key, mixed $stored_value, mixed $new_value )

Checks if the user provided value is equivalent to a stored value for the given meta key.


Description Description

WP_REST_Meta_Fields::is_meta_value_same_as_stored_value().


Top ↑

Parameters Parameters

$key

(string) (Required) The un-prefixed meta key being checked.

$stored_value

(mixed) (Required) The currently stored value retrieved from get_metadata().

$new_value

(mixed) (Required) The new value.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/abstracts/abstract.llms.post.model.php

1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
private function is_meta_value_same_as_stored_value( $key, $stored_value, $new_value ) {
 
    $sanitized = sanitize_meta( $this->meta_prefix . $key, $new_value, 'post', $this->db_post_type );
 
    // The return value of get_metadata will always be a string for scalar types.
    $scalar_types = array(
        'string',
        'text',
        'absint',
        'yesno',
        'html',
        'float',
        'int',
        'bool',
        'boolean',
    );
 
    if ( in_array( $this->get_property_type( $key ), $scalar_types, true ) ) {
        $sanitized = (string) $sanitized;
    }
 
    return $sanitized === $stored_value;
}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.