diff --git a/web/app/themes/juniper-theme/functions.php b/web/app/themes/juniper-theme/functions.php index f75d611f0..0fe9f1ec3 100644 --- a/web/app/themes/juniper-theme/functions.php +++ b/web/app/themes/juniper-theme/functions.php @@ -38,6 +38,16 @@ function juniper_editor_styles() { add_editor_style( '/dist/src/css/_app.css' ); } +/** + * This fixes the duplicate title issue with Rank Math and Yoast SEO. + */ +add_action( 'wp_head', 'juniper_fix_rankmath_duplicate_title', 0 ); +function juniper_fix_rankmath_duplicate_title(): void { + if ( defined( 'RANK_MATH_VERSION' ) || defined( 'WPSEO_VERSION' ) ) { + remove_action( 'wp_head', '_block_template_render_title_tag', 1 ); + } +} + /** * This ensures that Timber is loaded and available as a PHP class. * If not, it gives an error message to help direct developers on where to activate