Necesito hacer que todos los enlaces html de mi sitio web de wordpress no terminen en "?amp=1".
Por ejemplo el enlace:
<a href="https://example.com/page-1/?amp=1">Page 1</a>Debería cambiar a:
<a href="https://example.com/page-1/">Page 1</a>He agregado el siguiente código a mi archivo functions.php pero desafortunadamente no funciona.
function remove_amptoamp_links(){ ?> <script type="text/javascript"> jQuery(document).ready(function($){ $('a').each(function(){ if(this.href.indexOf("?amp=1") != -1) { var href=this.href.split("?amp=1")[0]; this.href = href; } }); }); </script>'; <?php } add_action('wp_footer', 'remove_amptoamp_links');¿Un poco de ayuda? ¡Gracias!
Finalmente descubrí que AMP no permite ejecutar Javascript.