In the text below, when I toggle the WYSIWYG view from Visual to Text, the anchors are left intact. However, when I switch back to Visual, the anchors are replaced with   elements.

This is the initial content markup in the WordPress editor (via Chrome inspector):

<body id="tinymce" class="mceContentBody content post-type-post post-status-publish post-format-standard wp-editor" onload="window.parent.tinyMCE.get('content').onLoad.dispatch();" contenteditable="true" dir="ltr"><p>This is the first sentence break. <a id="bookmark1" class="mceItemAnchor"></a>&nbsp;This is the seond sentence break. <a id="bookmark2" class="mceItemAnchor"></a>&nbsp;This is the third sentence break.</p><p><a id="bookmark3" class="mceItemAnchor"></a>&nbsp;This is the fourth sentence break.</p><p><a id="bookmark4" class="mceItemAnchor"></a>&nbsp;</p><p>This is the fifth sentence break.</p><p><a id="bookmark5" class="mceItemAnchor"></a>&nbsp;</p></body>

And this is what it looks like when I click on "Text" in the WordPress editor iframe:

This is the first sentence break. <a id="bookmark1"></a> This is the second sentence break. 

<a id="bookmark2"></a> This is the third sentence break.

<a id="bookmark3"></a> This is the fourth sentence break.

<a id="bookmark4"></a>

This is the fifth sentence break.

<a id="bookmark5"></a>

What are my options for fixing this so that the anchor tags are not replaced?

  • Which version of WordPress? I'm on 3.8.1 and it doesn't happen. Apr 16, 2014 at 17:40
  • This error begins with WP 3.9 and also exists in WP 4.0 Sep 25, 2014 at 15:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.