Add SVG image file to WordPress theme

Here’s how to add an .svg file to your a template in your WordPress theme – without having to paste the entire file contents:

I use this technique to add the main logo to a website. It would normally go in header.php but would work anywhere.


  • Thanks. It works like a charm. :) cheers.


    Perfect thank you !

    Is this solution enough secured against XSS attack and other security problems inherent to SVG files and XML ?


      Hi Tibow. If your SVG file is know to be clean of any harmful scripts, this technique will work just fine.


    Leave a Reply

    Your email address will not be published. Required fields are marked *

    See if Cinch is right for you.

    Ask us anything. Seriously. Like, what is the air speed velocity of an unladen swallow?

    Start a chat right now

    Or go ahead and Sign up now