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

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.

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.

{} Это метод класса: 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).
Whether to delete the old meta key/value-sets.
По умолчанию: false

Код WPSEO_Meta::replace_meta() Yoast 17.4

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
					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`
		$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 );