When using Wygwam and trying to use an empty <i> tag like Font Awesome requires the tags get stripped every time a user goes back in to edit the entry.

A temporary fix is to do something like <i class="icon-play">&nbsp;</i>, but that's pretty messy. Is there a way to either have Wygwam automatically add the &nbsp; code like it does for <p> tags or a way to make it stop stripping <i> tags that are "empty"?

  • I'm not quite following - can you give us the exact content you're entering into your Wygwam field that is getting improperly stripped? And are you doing this in the regular view, or source? Lastly - version numbers are always helpful!
    – Lisa
    Commented Mar 12, 2013 at 20:25
  • Hey Lisa, I just updated to 2.7 and no change there. If I use the Font Awesome syntax and try to add an icon like so: <i class="icon-play"></i> from the source view the icon is added properly. But if I go back to edit the entry, the whole tag has been stripped because there wasn't any "content" in it. Make sense? I've run across several others using CKEditor who have this problem, not sure the best way to adjust the config file for Wygwam to fix it - or if the config file is even the best way to do it. Commented Mar 12, 2013 at 20:43
  • Hey! So, I admit, I have not used Font Awesome. Can you tell me the exact code that is going into the textarea so that I can try it on my site? Even if it doesn't end up calling Font Awesome, the code should still show me if it strips out or not. Thank you!
    – Lisa
    Commented Mar 12, 2013 at 20:47
  • Apologies, every time I hit enter to add a new paragraph stackexchange submits the comment. Sigh. More info back in my second one :) Commented Mar 12, 2013 at 20:48
  • If you can put the copy/paste content into your original post, then you won't run into the comment limitations. :) But I think I understand; I'll test this this afternoon/evening.
    – Lisa
    Commented Mar 12, 2013 at 21:32

3 Answers 3


Alright - once I understood what was happening (comments on original post) I did some research. This is a CKEditor issue, below is a Git repo that includes a way to address this. I haven't tested this with Wygwam and can't endorse it, but it may help you toward a solution:


The common easy solution is to inclue &nbsp; so there is content between the tags.

Unfortunately I don't have another solution at this time, this is a change that needs to be made to CKEditor to handle.

  • I saw that on Github before I posted, but the I couldn't find the file referenced (tasks/widgets/ckeditor/config.js.cfm) in Wygwam's structure (and I thought there might be an easier way to change the config). Am I missing this file or is it called something else in Wygwam's file structure? Commented Mar 13, 2013 at 3:30
  • That may not actually work with CKEditor 3.x - it is more of a starting point for implementing that since it's not included with CKE. This is a definite 'roll your sleeves up and dig in' kind of change.
    – Lisa
    Commented Mar 13, 2013 at 16:04
  • Yes adding in the &nbsp; as Lisa stated above works.
    – Tad Ward
    Commented May 30, 2013 at 20:38

According to WYGWAM's Changelog, this was implemented in 2.6:

"Leading/trailing whitespace and empty tags are now stripped out from the content when saving"

There is the nbsp method, but also when editing in Source view, if you save -without- toggling Source, it won't strip your tags. When WYGWAM compiles the source it removes the tags.

This is something that's bugging me, too, so I hope somebody comes up with a setting to undo this "feature".


This sounds like a similar problem: https://drupal.org/node/1908696

In a nutshell, add this to your ckeditor config (themes/third_party/wygwam/lib/ckeditor/config.js):

config.protectedSource.push( /<i[^>]*><\/i>/g );

That didn't work for me, but it seems like it worked for some people. What worked for me was adding this:

CKEDITOR.dtd.$removeEmpty['i'] = false;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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