SVG Featured image not shown in twitter

Twitter has some limitations upon file extensions. I see that you’re passing on some variables within your meta tag. https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/markup.html URL of image to use in the card. Images must be less than 5MB in size. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. … Read more

Insert SVG code (not img) in HTML block

I tried this code on a clean install of WordPress <svg width=”100″ height=”100″> <circle cx=”50″ cy=”50″ r=”40″ stroke=”green” stroke-width=”4″ fill=”yellow” /> </svg> and used ‘Custom HTML’ in Guttenberg in a new post. This worked fine for me. The same code displayed in the DOM without deleting any tags or adding any Maybe you cant edit … Read more

Disable automatig SVG tag from menu

Copy functions.php from the parent theme into your child theme. Edit functions.php to remove the offending SVGs. NOTE: if wp_nav_menu() is called from another file (e.g., header.php), copy and edit that one instead.

Why does SVG upload in Media Library fail if the file does not have an XML tag at the beginning?

It seems that in the recent releases of WordPress, changes were made to the mime type handling to make sure that files have the extension they say they do: https://make.wordpress.org/core/2018/12/13/backwards-compatibility-breaks-in-5-0-1/ This poses an issue for SVG files without the tag in them. SVG is actually an XML, and WordPress is now requiring to have a … Read more

How to use a svg as custom header?

I solved it using the second way. I found out that you have to register the default image also. So after registering the svg as a default header it displays like it should! Here is my code: register_default_headers( array( ‘kami-logo’ => array( ‘url’ => get_stylesheet_directory_uri() . ‘/images/logo.svg’, ‘thumbnail_url’ => get_stylesheet_directory_uri() . ‘/images/logo.svg’, ‘description’ => __( … Read more

Set media metadata (i.e. “dimensions” field) on SVG file after extracting it with a filter

The wp_update_attachment_metadata filter fires every time you upload an image through media library (specifically every time wp_update_attachment_metadata function is being called). So when an svg file is uploaded we check if the file has the desired metadata, the width and height. If not, we generate the metadata as you did in your wp_get_attachment_image_src filter. Now … Read more