I've created a Text widget and put font-awesome icon HTML in editor Text Mode <i class="fab fa-facebook"></i> but toggling to Visual mode makes the code disappears though I can see it working on Frontend.

3 Answers 3


I think the issue is that WordPress removes empty tags from the editor. Try adding in a non-breaking space - Font Awesome should remove it so you shouldn't see any noticeable difference:

<i class="fab fa-facebook">&nbsp;</i>

You have used the wrong syntax.

True syntax is <i class="fa fa-facebook"></i>.
Also verify that you have added font-awesome in your theme and function file.

  • Not necessarily. Depends on the Font Awesome version. Font Awesome 5 uses fab instead of fa to display brands.
    – DSofa
    Jan 29, 2019 at 2:56

@Harsh - The original poster was using the syntax from Font Awesome 5, where different prefixes are used based on whether it is a brand (fab prefix), solid (fas prefix), regular (far prefix) and light (fal prefix).

Also, I found that the "&nbsp;" did resolve disappearing icon the issue for me.

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.