wpseo_canonical хук-фильтрYoast 1.0

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.

Где вызывается хук

Canonical_Presenter::get()
wpseo_canonical
yoast/src/presenters/canonical-presenter.php 50
return \urldecode( (string) \trim( \apply_filters( 'wpseo_canonical', $this->presentation->canonical, $this->presentation ) ) );

Где используется хук в Yoast SEO

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