WPSEO_Post_Metabox_Formatter::get_focus_keyword_usage()privateYoast 1.0

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

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

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

Возвращает

Массив. The keyword and the associated posts that use it.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_focus_keyword_usage();

Код WPSEO_Post_Metabox_Formatter::get_focus_keyword_usage() Yoast 22.4

private function get_focus_keyword_usage() {
	$keyword = WPSEO_Meta::get_value( 'focuskw', $this->post->ID );
	$usage   = [ $keyword => $this->get_keyword_usage_for_current_post( $keyword ) ];

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