0

I have made a fiddle showing my problem : https://jsfiddle.net/7r4y90xj/

I paste the code below :

<textarea id="acf-editor-115" class="wp-editor-area" name="acf[field_5e84a7a85a0a7][row-1][field_5e84a7f95a0a9]" style="height:300px;">
<a href="https://hub-roy.shop.secutix.com/selection/timeslotpass?productId=10228328078743&gtmStepTracking=true" target="_blank" rel="noopener">buy</a>
</textarea>

As you can see the href is transformed :

https://hub-roy.shop.secutix.com/selection/timeslotpass?productId=10228328078748>mStepTracking=true

The difference is between the &gt and > characters.

It seems that the browser detects the "&gt" as if it was the entity ">" and transforms it to the ">" character, which breaks everything in my page because the browser interprets it as a closing tag in the middle of the href...

Any idea why this happens and how to avoid it ?

thanks

Did you already have to face this issue when using ACF ? Do you have a fix ?

Thank you, Maxime.

Maxime Freschard
  • 1,066
  • 2
  • 15
  • 26

1 Answers1

1

You can replace & in &gt with &amp. That's simply replace & so it won't be interpreted as >. Maybe example will make more sense:

Before:

&gt

After:

&ampgt

Result:

&gt

I don't know if that solves your problem, but it works in the fiddle you sent.

In code:

enter image description here

Result in fiddle:

enter image description here

If you will have the same problem with others htmlentities, here's list of them: https://dev.w3.org/html5/html-author/charref

blazej
  • 927
  • 4
  • 11
  • 21
  • thanks, that makes sense. But what I was surprised about is that I thought an HTML entity is supposed to end with the ; character. Here, the browser takes the &gt string (without the ; character) and interprets it as an entity. Is this normal ? – Maxime Freschard Jun 22 '21 at 07:35
  • That's right that `&gt` should be with `;` on the end. But I tested it and browsers interprets it as a HTML entity event when `;` is not present in the very end. – blazej Jun 22 '21 at 07:41
  • Also, if my post helped you, could you sign it as an accepted answer? It would be very much appreciated – blazej Jun 22 '21 at 07:45