From 9fa65125d2c5aa7db89d0830eb600780d3abff74 Mon Sep 17 00:00:00 2001 From: Erick Hitter <services@ethitter.com> Date: Mon, 15 Feb 2016 23:31:23 -0800 Subject: [PATCH] Defer to HeadSpace2 when active --- eth-escape-headspace.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/eth-escape-headspace.php b/eth-escape-headspace.php index 929ac1d..2d843ed 100644 --- a/eth-escape-headspace.php +++ b/eth-escape-headspace.php @@ -67,11 +67,24 @@ class ETH_Escape_HeadSpace2 { ); /** - * Register plugin's hooks + * Defer plugin hook additions until all plugins are loaded + * Allows plugin to defer to HeadSpace2 when active * * @return null */ private function __construct() { + add_action( 'plugins_loaded', array( $this, 'maybe_add_hooks' ) ); + } + + /** + * Conditionally register plugin's hooks + */ + public function maybe_add_hooks() { + // Defer to HeadSpace2 when active + if ( class_exists( 'HeadSpace_Plugin' ) ) { + return; + } + add_filter( 'pre_get_document_title', array( $this, 'filter_pre_get_document_title' ) ); add_filter( 'wp_title', array( $this, 'filter_wp_title' ), 10, 3 ); -- GitLab