Created
February 28, 2017 19:07
-
-
Save lnorton89/ba7dbac56c386746628bf36ee5abeabb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The Events Calendar - Yoast SEO - Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,) | |
* @TEC - 3.11 | |
* @Yoast - 2.3.4 | |
*/ | |
add_action( 'pre_get_posts', 'tribe_remove_wpseo_title_rewrite', 20 ); | |
function tribe_remove_wpseo_title_rewrite() { | |
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) { | |
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) { | |
$wpseo_front = WPSEO_Frontend::get_instance(); | |
remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 ); | |
} | |
} elseif ( class_exists( 'Tribe__Events__Main' ) && !class_exists( 'Tribe__Events__Pro__Main' ) ) { | |
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) { | |
$wpseo_front = WPSEO_Frontend::get_instance(); | |
remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 ); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment