From ace6bfe671a07187281ad61b24a092a258088948 Mon Sep 17 00:00:00 2001 From: Erick Hitter <services@ethitter.com> Date: Mon, 15 Feb 2016 22:15:13 -0800 Subject: [PATCH] Page title, for WP 4.1+ --- eth-escape-headspace.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eth-escape-headspace.php b/eth-escape-headspace.php index 4a2a62f..b33c86a 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; + } + /** * */ -- GitLab