wpseo_canonical
Filter: wpseo_canonical Allow filtering of the canonical URL put out by Yoast SEO.
Использование
add_filter( 'wpseo_canonical', 'wp_kama_wpseo_canonical_filter', 10, 2 ); /** * Function for `wpseo_canonical` filter-hook. * * @param string $canonical The canonical URL. * @param Indexable_Presentation $presentation The presentation of an indexable. * * @return string */ function wp_kama_wpseo_canonical_filter( $canonical, $presentation ){ // filter... return $canonical; }
- $canonical(строка)
- The canonical URL.
- $presentation(Indexable_Presentation)
- The presentation of an indexable.
Где вызывается хук
wpseo_canonical
yoast/src/presenters/canonical-presenter.php 49
return \urldecode( (string) \trim( \apply_filters( 'wpseo_canonical', $this->presentation->canonical, $this->presentation ) ) );