wc_page_endpoint_title

Replace a page title with the endpoint title.

Description

(string) wc_page_endpoint_title( (string) $title ); 

Returns (string)

Parameters (1)

0. $title (string)
The title.

Usage

  1. if ( !function_exists( 'wc_page_endpoint_title' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-page-functions.php'; 
  3.  
  4. // The title. 
  5. $title = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_page_endpoint_title($title); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-page-functions.php  
  1. function wc_page_endpoint_title( $title ) { 
  2. global $wp_query; 
  3.  
  4. if ( ! is_null( $wp_query ) && ! is_admin() && is_main_query() && in_the_loop() && is_page() && is_wc_endpoint_url() ) { 
  5. $endpoint = WC()->query->get_current_endpoint(); 
  6.  
  7. if ( $endpoint_title = WC()->query->get_endpoint_title( $endpoint ) ) { 
  8. $title = $endpoint_title; 
  9.  
  10. remove_filter( 'the_title', 'wc_page_endpoint_title' ); 
  11.  
  12. return $title;