wc_page_endpoint_document_title_parts()
Replace the title part of the document title.
Хуков нет.
Возвращает
Массив
.
Использование
wc_page_endpoint_document_title_parts( $title );
- $title(массив) (обязательный)
The document title parts.
-
title(строка)
Title of the viewed page. -
page(строка)
Optional. Page number if paginated. -
tagline(строка)
Optional. Site description when on home page. - site(строка)
Optional. Site title when not on home page.
-
Код wc_page_endpoint_document_title_parts() wc page endpoint document title parts WC 9.6.1
function wc_page_endpoint_document_title_parts( $title ) { global $wp_query; if ( ! is_null( $wp_query ) && ! is_admin() && is_main_query() && is_page() && is_wc_endpoint_url() ) { $endpoint = WC()->query->get_current_endpoint(); $action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $endpoint_title = WC()->query->get_endpoint_title( $endpoint, $action ); $title['title'] = $endpoint_title ? $endpoint_title : $title['title']; remove_filter( 'document_title_parts', 'wc_page_endpoint_document_title_parts' ); } return $title; }