WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Авторские Темы для WordPress
функция не описана

WPSEO_Meta::replace_meta() public Yoast 1.0

Used for imports, this functions imports the value of $old_metakey into $new_metakey for those post where no WPSEO meta data has been set. Optionally deletes the $old_metakey values.

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

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = WPSEO_Meta::replace_meta( $old_metakey, $new_metakey, $delete_old );
$old_metakey(строка) (обязательный)
The old key of the meta value.
$new_metakey(строка) (обязательный)
The new key, usually the WPSEO meta key (including prefix).
$delete_old(true|false)
Whether to delete the old meta key/value-sets.

Код WPSEO_Meta::replace_meta() Yoast 16.2

<?php
public static function replace_meta( $old_metakey, $new_metakey, $delete_old = false ) {
	global $wpdb;

	/*
	 * Get only those rows where no wpseo meta values exist for the same post
	 * (with the exception of linkdex as that will be set independently of whether the post has been edited).
	 *
	 * {@internal Query is pretty well optimized this way.}}
	 */
	$query  = $wpdb->prepare(
		"
			SELECT `a`.*
			FROM {$wpdb->postmeta} AS a
			WHERE `a`.`meta_key` = %s
				AND NOT	EXISTS (
					SELECT DISTINCT `post_id` , count( `meta_id` ) AS count
					FROM {$wpdb->postmeta} AS b
					WHERE `a`.`post_id` = `b`.`post_id`
						AND `meta_key` LIKE %s
						AND `meta_key` <> %s
					GROUP BY `post_id`
				)
			;",
		$old_metakey,
		$wpdb->esc_like( self::$meta_prefix . '%' ),
		self::$meta_prefix . 'linkdex'
	);
	$oldies = $wpdb->get_results( $query );

	if ( is_array( $oldies ) && $oldies !== [] ) {
		foreach ( $oldies as $old ) {
			update_post_meta( $old->post_id, $new_metakey, $old->meta_value );
		}
	}

	// Delete old keys.
	if ( $delete_old === true ) {
		delete_post_meta_by_key( $old_metakey );
	}
}