sanitize_meta

Advertisement

Summery Summery

Sanitizes meta value.

Syntax Syntax

sanitize_meta( string $meta_key, mixed $meta_value, string $object_type, string $object_subtype = '' )

Parameters Parameters

$meta_key

(Required) Metadata key.

$meta_value

(Required) Metadata value to sanitize.

$object_type

(Required) Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

$object_subtype

(Optional) The subtype of the object type.

Default value: ''

Return Return

(mixed) Sanitized $meta_value.

Source Source

File: wp-includes/meta.php

			// Add a value to the current pid/key.
			$cache[ $mpid ][ $mkey ][] = $mval;
		}
	}

	foreach ( $non_cached_ids as $id ) {
		if ( ! isset( $cache[ $id ] ) ) {
			$cache[ $id ] = array();
		}
		wp_cache_add( $id, $cache[ $id ], $cache_key );
	}

	return $cache;
}

/**
 * Retrieves the queue for lazy-loading metadata.
 *
 * @since 4.5.0
 *
 * @return WP_Metadata_Lazyloader Metadata lazyloader queue.
 */
function wp_metadata_lazyloader() {
	static $wp_metadata_lazyloader;

	if ( null === $wp_metadata_lazyloader ) {
		$wp_metadata_lazyloader = new WP_Metadata_Lazyloader();
	}

	return $wp_metadata_lazyloader;
}

/**
 * Given a meta query, generates SQL clauses to be appended to a main query.
 *
 * @since 3.2.0

Advertisement

Changelog Changelog

Changelog
Version Description
4.9.8 The $object_subtype parameter was added.
3.1.3 Introduced.

Advertisement

Leave a Reply