wc_page_endpoint_title()
Replace a page title with the endpoint title.
No Hooks.
Returns
String.
Usage
wc_page_endpoint_title( $title );
- $title(string) (required)
- Post title.
wc_page_endpoint_title() wc page endpoint title code WC 10.5.0
function wc_page_endpoint_title( $title ) {
global $wp_query;
if ( ! is_null( $wp_query ) && ! is_admin() && is_main_query() && in_the_loop() && is_page() && is_wc_endpoint_url() ) {
$endpoint = WC()->query->get_current_endpoint();
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
$endpoint_title = WC()->query->get_endpoint_title( $endpoint, $action );
$title = $endpoint_title ? $endpoint_title : $title;
remove_filter( 'the_title', 'wc_page_endpoint_title' );
}
return $title;
}