WPSEO_Post_Type_Sitemap_Provider::get_post_type_archive_link() protected Yoast 5.3
Get URL for a post type archive.
{} Это метод класса: WPSEO_Post_Type_Sitemap_Provider{}
Хуков нет.
Возвращает
Строку/true/false. URL or false if it should be excluded.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_post_type_archive_link( $post_type );
- $post_type(строка) (обязательный)
- Post type.
Список изменений
С версии 5.3 | Введена. |
Код WPSEO_Post_Type_Sitemap_Provider::get_post_type_archive_link() WPSEO Post Type Sitemap Provider::get post type archive link Yoast 15.9
protected function get_post_type_archive_link( $post_type ) {
$pt_archive_page_id = -1;
if ( $post_type === 'post' ) {
if ( get_option( 'show_on_front' ) === 'posts' ) {
return YoastSEO()->helpers->url->home();
}
$pt_archive_page_id = (int) get_option( 'page_for_posts' );
// Post archive should be excluded if posts page isn't set.
if ( $pt_archive_page_id <= 0 ) {
return false;
}
}
if ( ! $this->is_post_type_archive_indexable( $post_type, $pt_archive_page_id ) ) {
return false;
}
return get_post_type_archive_link( $post_type );
}