WPSEO_Meta::dont_save_meta_if_default()public staticYoast 1.0

Prevent adding of default values to the database.

{} Это метод класса: WPSEO_Meta{}

Хуков нет.


true|false|null. True = stop saving, null = continue saving.


$result = WPSEO_Meta::dont_save_meta_if_default( $check, $object_id, $meta_key, $meta_value );
$check(true|false) (обязательный)
The current status to allow adding metadata for the given type.
$object_id(int) (обязательный)
ID of the current object for which the meta is being added.
$meta_key(строка) (обязательный)
The full meta key (including prefix).
$meta_value(строка) (обязательный)
New meta value.

Код WPSEO_Meta::dont_save_meta_if_default() Yoast 19.7.2

public static function dont_save_meta_if_default( $check, $object_id, $meta_key, $meta_value ) {
	/* If it's one of our meta fields, check against default. */
	if ( isset( self::$fields_index[ $meta_key ] ) && self::meta_value_is_default( $meta_key, $meta_value ) === true ) {
		return true; // Stop saving the value.

	return $check; // Go on with the normal execution (add) in meta.php.