Yoast\WP\SEO\Actions\Importing\Aioseo

Aioseo_Posts_Importing_Action::keyphrase_import()publicYoast 1.0

Plucks the keyphrase to be imported from the AIOSEO array of keyphrase meta data.

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

Хуков нет.

Возвращает

Строку|null. The plucked keyphrase.

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

$Aioseo_Posts_Importing_Action = new Aioseo_Posts_Importing_Action();
$Aioseo_Posts_Importing_Action->keyphrase_import( $aioseo_data, $aioseo_key );
$aioseo_data(массив) (обязательный)
All of the AIOSEO data to be imported.
$aioseo_key(строка) (обязательный)
The AIOSEO key that contains the setting we're working with, aka keyphrases.

Код Aioseo_Posts_Importing_Action::keyphrase_import() Yoast 24.0

public function keyphrase_import( $aioseo_data, $aioseo_key ) {
	$meta_data = \json_decode( $aioseo_data[ $aioseo_key ], true );
	if ( ! isset( $meta_data['focus']['keyphrase'] ) ) {
		return null;
	}

	return $this->sanitization->sanitize_text_field( $meta_data['focus']['keyphrase'] );
}