I'm trying to allow anchors in my ckeditor but they always get wiped out by the WYSIWYG filter module.

For hyperlinks, my allowed attributes in WYSIWYG filter are "a[!href|target<_blank|title|id|name]". Then in the Rules for Element IDs section, I put "anchor*".

So in my content, when I add an anchor named "anchor1", it adds <p><a id="anchor1" name="anchor1"></a></p> to the markup, which get replaced by <p>&nbsp;</p> once I save the content.

What am I missing to get this to work ?

Thanks !


According to the WYSIWYG Filter module page it follows TinyMCE valid elements syntax. From that page:

! Makes attributes required. If none of the required attributes are set, the element will be removed. For example, "!href".

It looks like your attribute string uses the exclamation mark to make the 'href' attribute required but the <a> tag you're putting in your content does not have that attribute so the element is being removed.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.