WPSEO_Frontend::canonical()publicYoast 1.0

Outputs the canonical value.

Метод класса: WPSEO_Frontend{}

Хуков нет.




$WPSEO_Frontend = new WPSEO_Frontend();
$WPSEO_Frontend->canonical( $echo, $un_paged, $no_override );
Whether or not to output the canonical element.
По умолчанию: true
Whether or not to return the canonical with or without pagination added to the URL.
По умолчанию: false
Whether or not to return a manually overridden canonical.
По умолчанию: false

Код WPSEO_Frontend::canonical() Yoast 22.1

public function canonical( $echo = true, $un_paged = false, $no_override = false ) {
	_deprecated_function( __METHOD__, 'Yoast SEO 14.0' );

	$presentation = $this->get_current_page_presentation();
	$presenter    = new Canonical_Presenter();

	/** This filter is documented in src/integrations/front-end-integration.php */
	$presenter->presentation = $presentation;
	$presenter->helpers      = $this->helpers;
	$presenter->replace_vars = $this->replace_vars;

	if ( ! $echo ) {
		return $presenter->get();

	echo $presenter->present();