wpseo_posts_for_related_keywords
Allows enhancing the array of posts' that share their focus keywords with the post's related keywords.
Использование
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 keywords with the post. * @param int $post_id The id of the post we're finding the usage of related keywords for. * * @return array */ function wp_kama_wpseo_posts_for_related_keywords_filter( $usage, $post_id ){ // filter... return $usage; }
- $usage(массив)
- The array of posts' ids that share their focus keywords with the post.
- $post_id(int)
- The id of the post we're finding the usage of related keywords for.
Где вызывается хук
wpseo_posts_for_related_keywords
yoast/admin/formatter/class-post-metabox-formatter.php 170
return apply_filters( 'wpseo_posts_for_related_keywords', $usage, $this->post->ID );