Yoast\WP\SEO\Builders
Indexable_Link_Builder::filter_link() protected Yoast 1.0
Filters out links that point to the same page with a fragment or query.
{} Это метод класса: Indexable_Link_Builder{}
Хуков нет.
Возвращает
true/false.. Whether or not the link should be filtered.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->filter_link( $link, $current_url );
- $link(SEO_Links) (обязательный)
- The link.
- $current_url(массив) (обязательный)
- The url of the page the link is on, as parsed by wp_parse_url.
Код Indexable_Link_Builder::filter_link() Indexable Link Builder::filter link Yoast 15.6.2
protected function filter_link( SEO_Links $link, $current_url ) {
$url = $link->parsed_url;
// Always keep external links.
if ( $link->type === SEO_Links::TYPE_EXTERNAL ) {
return true;
}
// Always keep links with an empty path or pointing to other pages.
if ( isset( $url['path'] ) ) {
return empty( $url['path'] ) || $url['path'] !== $current_url['path'];
}
// Only keep links to the current page without a fragment or query.
return ( ! isset( $url['fragment'] ) && ! isset( $url['query'] ) );
}