Bladeren bron

Merge pull request #1653 from westonruter/fix/skip-focus-link-fix-amp

Varia: Skip skip-link-focus-fix in AMP
Michael Cain 5 jaren geleden
bovenliggende
commit
4362cb45c1
1 gewijzigde bestanden met toevoegingen van 6 en 0 verwijderingen
  1. 6 0
      varia/functions.php

+ 6 - 0
varia/functions.php

@@ -273,6 +273,12 @@ add_action( 'wp_enqueue_scripts', 'varia_scripts' );
  * @link https://git.io/vWdr2
  */
 function varia_skip_link_focus_fix() {
+	// Prevent outputting skip-link-focus-fix in AMP since the AMP framework has it built-in,
+	// per <https://github.com/ampproject/amphtml/issues/18671>.
+	if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
+		return;
+	}
+
 	// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
 	?>
 	<script>