WPSEO_Admin_Bar_Menu::get_post_focus_keyword()protectedYoast 1.0

Gets the focus keyword for a given post.

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

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

Возвращает

Строку. Focus keyword, or empty string if none available.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_post_focus_keyword( $post );
$post(WP_Post) (обязательный)
Post object to get its focus keyword.

Код WPSEO_Admin_Bar_Menu::get_post_focus_keyword() Yoast 22.3

protected function get_post_focus_keyword( $post ) {
	if ( ! is_object( $post ) || ! property_exists( $post, 'ID' ) ) {
		return '';
	}

	/**
	 * Filter: 'wpseo_use_page_analysis' Determines if the analysis should be enabled.
	 *
	 * @param bool $enabled Determines if the analysis should be enabled.
	 */
	if ( apply_filters( 'wpseo_use_page_analysis', true ) !== true ) {
		return '';
	}

	return WPSEO_Meta::get_value( 'focuskw', $post->ID );
}