Yoast\WP\SEO\Editors\Framework\Seo\Posts

Keyphrase_Data_Provider::get_focus_keyphrase_usage()publicYoast 1.0

Counts the number of given Keyphrase used for other posts other than the given post_id.

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

Хуки из метода

Возвращает

Массив<Строку>. The keyphrase and the associated posts that use it.

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

$Keyphrase_Data_Provider = new Keyphrase_Data_Provider();
$Keyphrase_Data_Provider->get_focus_keyphrase_usage(): array;

Код Keyphrase_Data_Provider::get_focus_keyphrase_usage() Yoast 25.1

public function get_focus_keyphrase_usage(): array {
	$keyphrase = $this->meta_helper->get_value( 'focuskw', $this->post->ID );
	$usage     = [ $keyphrase => $this->get_keyphrase_usage_for_current_post( $keyphrase ) ];

	/**
	 * Allows enhancing the array of posts' that share their focus Keyphrase with the post's related Keyphrase.
	 *
	 * @param array<string> $usage   The array of posts' ids that share their focus Keyphrase with the post.
	 * @param int           $post_id The id of the post we're finding the usage of related Keyphrase for.
	 */
	return \apply_filters( 'wpseo_posts_for_related_keywords', $usage, $this->post->ID );
}