Svg support


Do you have a bulletproof svg upload method and best practice considering Wordpress(in combination with Beaver Builder plugin)?

I can upload svg’s when using this codesnippet:

function cstm_mime_types( $mimes ){
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
add_action( 'upload_mimes', 'cstm_mime_types' );

and preview the svg;s in Wordpress with some injected css:

    img[src$=".svg"], img[src$=".svg"],
    #postimagediv img[src$=".svg"] {
      width: 100% !important;
      height: auto !important;

Some issues i encountered when using svg’s with the BB plugin:

1)When using the callout module when uploading an image, i get this error:

<b>Notice</b>: Undefined property: stdClass::$photo_src in /htdocs/wp-content/plugins/bb-plugin/modules/callout/callout.php</b> on line <b>175</b>

2)When i insert svg with the BB photo module nothing happens.

When i insert the svg wih the BB Rich Text modue it does work.

Do you think there is a bulletproof solution or best practice? Or should we just wait until Worpress fully supports svg’s? I really need svg on my sites anno 2015 :wink:

Thanks in advance for your thoughts on this!

Kind regards,

Hey Jorrit,

It sounds like we have a bug somewhere with additional mimes. I’ll make a note to look into a fix for this.


Hey Jorrit,

I just implemented a fix so the photo field can now support SVG. That will be coming in the next update this evening.


Hey Justin,

Thank you very much for your reply and great to see that the fix already has been deployed!


You’re welcome!