diff --git a/eth-escape-headspace.php b/eth-escape-headspace.php index 4a2a62f4428885a263259e9a9f7de2b1fca945f9..b33c86a330e54ea2230bf853170a2e5691cb3b6a 100644 --- a/eth-escape-headspace.php +++ b/eth-escape-headspace.php @@ -72,10 +72,26 @@ class ETH_Escape_HeadSpace2 { * @return null */ private function __construct() { + add_filter( 'pre_get_document_title', array( $this, 'filter_pre_get_document_title' ) ); add_action( 'wp_head', array( $this, 'action_wp_head' ) ); add_action( 'wp_footer', array( $this, 'action_wp_footer' ) ); } + /** + * + */ + public function filter_pre_get_document_title( $title ) { + $_title = get_post_meta( get_the_ID(), '_headspace_page_title', true ); + + if ( ! empty( $_title ) ) { + $title = esc_html( $_title ); + } + + unset( $_title ); + + return $title; + } + /** * */