wc_page_endpoint_document_title_parts()
Replace the title part of the document title.
No Hooks.
Return
Array
.
Usage
wc_page_endpoint_document_title_parts( $title );
- $title(array) (required)
The document title parts.
-
title(string)
Title of the viewed page. -
page(string)
Optional. Page number if paginated. -
tagline(string)
Optional. Site description when on home page. - site(string)
Optional. Site title when not on home page.
-
wc_page_endpoint_document_title_parts() wc page endpoint document title parts code 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; }