Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

69
Vistas
How to remove part of href tag from links using jquery in wordpress

I need to make all html links of my wordpress website dont end in "?amp=1".

For example the link:

<a href="https://example.com/page-1/?amp=1">Page 1</a>

It should change to:

<a href="https://example.com/page-1/">Page 1</a>

I have added the following code to my functions.php file but unfortunately it doesn't work.

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');

Some help? Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have finally discovered that AMP does not allow Javascript to be executed.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda