This plugin recently started overwriting Yoast SEO title tags in Event Categories. Using the supplied function, I have modified it to work for Yoast SEO:
// The Events Calendar Category Title Tag Fix to Show Yoast SEO Title
function events_category_title_yoast( $title ) {
if ( tribe_is_event_category() ) {
$term = get_queried_object();
// Check if Yoast SEO is activated
if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) ) {
$options = get_option( 'wpseo_taxonomy_meta' );
// Check if the keys exist in the options array
if ( isset( $options[$term->taxonomy][$term->term_id]['wpseo_title'] ) ) {
$yoast_title = $options[$term->taxonomy][$term->term_id]['wpseo_title'];
// If Yoast title exists, use it
if ( ! empty( $yoast_title ) ) {
return $yoast_title;
}
}
}
}
return $title;
}
add_filter( 'tribe_events_title_tag', 'events_category_title_yoast' );
-
This reply was modified 1 year, 1 month ago by Daniel Chase. Reason: found my own solution