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

	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.