Font awesome Icon HTML in widgets disappear on save

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.

Topic widget-text icon widgets Wordpress

Category Web


@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 " " did resolve disappearing icon the issue for me.


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.