Yoast\WP\SEO\Presentations
Indexable_Post_Type_Presentation::generate_canonical()
Generates the canonical.
Метод класса: Indexable_Post_Type_Presentation{}
Хуков нет.
Возвращает
Строку
. The canonical.
Использование
$Indexable_Post_Type_Presentation = new Indexable_Post_Type_Presentation(); $Indexable_Post_Type_Presentation->generate_canonical();
Код Indexable_Post_Type_Presentation::generate_canonical() Indexable Post Type Presentation::generate canonical Yoast 22.3
public function generate_canonical() { if ( $this->model->canonical ) { return $this->model->canonical; } $permalink = $this->permalink; // Fix paginated pages canonical, but only if the page is truly paginated. $current_page = $this->pagination->get_current_post_page_number(); if ( $current_page > 1 ) { $number_of_pages = $this->model->number_of_pages; if ( $number_of_pages && $current_page <= $number_of_pages ) { $permalink = $this->get_paginated_url( $permalink, $current_page ); } } return $this->url->ensure_absolute_url( $permalink ); }