WPSEO_Import_AIOSEO_V4::meta_key_clone_replace()protectedYoast 1.0

Replaces the AiOSEO variables in our temporary table with Yoast variables (replace vars).

Метод класса: WPSEO_Import_AIOSEO_V4{}

Хуков нет.


null. Ничего (null).


// protected - в коде основоного (родительского) или дочернего класса
$result = $this->meta_key_clone_replace( $replace_values );
$replace_values(массив) (обязательный)
Key value pair of values to replace with other values. This is only used in the base class but not here. That is because this class doesn't have any convert keys in $clone_keys. For that reason, we're overwriting the base class' meta_key_clone_replace() function without executing that base functionality.

Код WPSEO_Import_AIOSEO_V4::meta_key_clone_replace() Yoast 21.6

protected function meta_key_clone_replace( $replace_values ) {
	global $wpdb;

	// At this point we're already looping through all the $clone_keys (this happens in meta_keys_clone() in the abstract class).
	// Now, we'll also loop through the replace_vars array, which holds the mappings between the AiOSEO variables and the Yoast variables.
	// We'll replace all the AiOSEO variables in the temporary table with their Yoast equivalents.
	foreach ( $this->replace_vars as $aioseo_variable => $yoast_variable ) {
		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: We need this query and this is done at many other places as well, for example class-import-rankmath.
				'UPDATE tmp_meta_table SET meta_value = REPLACE( meta_value, %s, %s )',

	// The AiOSEO custom fields take the form of `#custom_field-myfield`.
	// These should be mapped to %%cf_myfield%%.
	$meta_values_with_custom_fields = $this->get_meta_values_with_custom_field_or_taxonomy( $wpdb, 'custom_field' );
	$unique_custom_fields           = $this->get_unique_custom_fields_or_taxonomies( $meta_values_with_custom_fields, 'custom_field' );
	$this->replace_custom_field_or_taxonomy_replace_vars( $unique_custom_fields, $wpdb, 'custom_field', 'cf' );

	// Map `#tax_name-{tax-slug}` to `%%ct_{tax-slug}%%``.
	$meta_values_with_custom_taxonomies = $this->get_meta_values_with_custom_field_or_taxonomy( $wpdb, 'tax_name' );
	$unique_custom_taxonomies           = $this->get_unique_custom_fields_or_taxonomies( $meta_values_with_custom_taxonomies, 'tax_name' );
	$this->replace_custom_field_or_taxonomy_replace_vars( $unique_custom_taxonomies, $wpdb, 'tax_name', 'ct' );