WPSEO_Plugin_Importer::import_meta_helper()protectedYoast 1.0

Helper function to search for a key in an array and maybe save it as a meta field.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->import_meta_helper( $plugin_key, $yoast_key, $data, $post_id );
$plugin_key(строка) (обязательный)
The key in the $data array to check.
$yoast_key(строка) (обязательный)
The identifier we use in our meta settings.
$data(массив) (обязательный)
The array of data for this post to sift through.
$post_id(int) (обязательный)
The post ID.

Код WPSEO_Plugin_Importer::import_meta_helper() Yoast 22.4

protected function import_meta_helper( $plugin_key, $yoast_key, $data, $post_id ) {
	if ( ! empty( $data[ $plugin_key ] ) ) {
		$this->maybe_save_post_meta( $yoast_key, $data[ $plugin_key ], $post_id );
	}
}