wpseo_posts_for_related_keywords
Allows enhancing the array of posts' that share their focus Keyphrase with the post's related Keyphrase.
Использование
add_filter( 'wpseo_posts_for_related_keywords', 'wp_kama_wpseo_posts_for_related_keywords_filter', 10, 2 ); /** * Function for `wpseo_posts_for_related_keywords` filter-hook. * * @param array$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 array */ function wp_kama_wpseo_posts_for_related_keywords_filter( $usage, $post_id ){ // filter... return $usage; }
- $usage(array
) - The array of posts' ids that share their focus Keyphrase with the post.
- $post_id(int)
- The id of the post we're finding the usage of related Keyphrase for.
Где вызывается хук
yoast/src/editors/framework/seo/posts/keyphrase-data-provider.php 48
return \apply_filters( 'wpseo_posts_for_related_keywords', $usage, $this->post->ID );