As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [svg]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

Interactive SVG not showing

I have a problem with implementation interactive svg to our website. In the page edit view (elementor) the file works fine, it displays and there is an animation on hover. But after save and check ...
0 votes
1 answer
13 views

Why isn't my SVG path rotating on scroll on iPhones?

I'm trying to get a path inside an inline SVG in the Header of my website to rotate when the user scrolls the page. It's a really neat feature, but it's not working on some iPhones. Here's the ...
0 votes
2 answers
166 views

Can't upload svg files in WordPress

I am facing the following issue while uploading any SVG file and sometimes face the same issue while uploading any image. "The server cannot process the image. This can happen if the server is ...
2 votes
1 answer
781 views

Featured Image .svg height and width 1px only

I need to create a custom type post where will be added the name of the client and its logo. The logo will be added as a Featured Image. But the problem is that WordPress does not recognize the SVG ...
0 votes
1 answer
731 views

SVG upload does not work

I have created an SVG with clickable areas to be used as landing page image, The size of the file is 4 MB. I cannot upload it, Wordpess says there is an error (no specifics). Size seems not to be the ...
0 votes
1 answer
2k views

Enable CORS for getting an inline SVG by URL

TLDR; Is there a way I can enable CORS for SVGs in my WordPress back-end, so I can get them through a http request to a different domain? Ideally without having to touch .htaccess? What I'm aiming ...
0 votes
1 answer
2k views

How to use Illustrator AI file to design a Wordpress website

I am very new to Wordpress. I have an AI file and I am supposed to build a website out of it. Just have some difficulties in doing that. I select some slices in Adobe Illustrator and export them into ...
7 votes
6 answers
14k views

How to upload SVG in WordPress 4.9.8?

I tried uploading after installing different plugins. Even added a filter to functions.php file. function add_svg_to_upload_mimes( $upload_mimes ) { $upload_mimes['svg'] = 'image/svg+xml'; ...
0 votes
1 answer
419 views

Replace custom SVG icons in Twenty Twenty-One

I was trying to investigate how to replace some icons of the parent theme with the child theme but I was not able to do it. I am trying to replace the SVG icons that are in the twentytwentyone\classes\...
0 votes
0 answers
41 views

SVG Icon Code Support in WordPress Custom Html Widget? Not Working

I am Trying to Add SVG Icon Code in Custom HTML Widget, it is not working showing following error "There is 1 error which must be fixed before you can save.". How we can fix it without ...
-1 votes
3 answers
1k views

How to delay display of page elements until enqueued script has injected html

I am enqueuing some javascript that injects SVGs into my page's DOM (called SVGInjector); it works great except for one thing: there is an undesirable "blink"/shift of elements on my screen ...
0 votes
2 answers
23 views

Why are some SVG-images not visible in my footer?

On our website, we have a footer (built with WP-Bakery) that includes the typical information that is needed, plus there is a section that should show the different types of payment methods that we ...
6 votes
2 answers
3k views

Escaping SVG with KSES

I'm trying to output an SVG file in a template, and PHPCS is telling me I need to escape the output. So I tried with KSES and it doesn't seem to want to include the viewbox attribute. $allowed_html =...
4 votes
2 answers
932 views

getting uploaded SVG dimensions on front-end

Having successfully uploaded an SVG image through WordPress's back-end media uploader with the help of a third party plugin such as Safe SVG by Daryll Doyle, how can one get the image's dimensions ...
5 votes
2 answers
641 views

Tiny MCE editor stripping xlink:href parameter from SVG USE tag

I have an inline SVG tag with an embedded <USE> tag. HTML: <ul> <li><svg class="icon-user"><use xlink:href="#icon-user"></use></svg> My Account</li>...
0 votes
1 answer
76 views

How to prevent Wordpress to remove my embedded SVG images

I run my own wordpress (not on wordpress.com) I'm trying to minimize the number of image files and embed some very small images directly into HTML code using the classic editor. However, when I save ...
2 votes
1 answer
748 views

How to remove SVG Files inline code of Wordpress Footer?

After the latest update of WordPress version 5.9, I saw that there was a svg files added at the bottom of the page. Can you please tell me, how to remove this? What's the use of it?
0 votes
1 answer
3k views

change with CSS the color of an svg background image set with "background-image: url()"

does anyone knows if it is possible to change the color (the stroke and fill attributes) of a SVG illustration used as a background with background-image: url() directly via CSS? Thank you
0 votes
1 answer
32 views

How to upload and style svg logo?

WP beginner here. I'm trying to upload an svg logo to my site. The logo can be accessed here. If you open it in the browser and inspect it, it should show the svg tags around the object. I've ...
0 votes
2 answers
135 views

download svg to png size image

I would like to have an svg downloaded from my site as a png. Searching I found this code and I must say that everything works. The site is a project that will only be viewed from mobile https://7c81b....
0 votes
1 answer
605 views

How do I include SVG file used as featured image?

I'm new, can I use include() or get_template_part to load an SVG file uploaded as featured image directly in the HTML page? I need to animate the svg images, but i need to easily change the image on ...
3 votes
1 answer
5k views

Allowing SVG uploads in media uploader without plug-in

I have previously managed to utilise this block of code within my functions.php file to enable and create thumbnails for SVGs that are uploaded to my site: // ALLOW SVG function ...
0 votes
1 answer
252 views

Whitelist a single SVG for use in post_content

I have a block built in Gutenberg - in it I use an Icon element from '@wordpress/components' I use a single arrow to create a dropdown which renders as an SVG. Of course when anyone who is not a super ...
0 votes
1 answer
882 views

Upload Custom Mime Types in WordPress (SVG, WebP)

I have a plugin I created to allow for us to add additional image types (webp, svg, etc). For some reason it is failing and will not allow me to add svg. Could use an extra set of eyes on this one ...
0 votes
1 answer
89 views

Hover a css icon width other color inside wp_get_attachment_image

I'm using ACF and have inside a loop: <?php echo wp_get_attachment_image( $button_image, 'small', 'sidebar-btn-icon', ["class" => "sidebar-btn-icon" , "alt"=> &...
1 vote
0 answers
164 views

Use Icomoon external svg file with <use>

Try to load external SVG icon with no html coding, just using my child functions.php file. I can get the icon with link to be "clickable", so link to e.g. Facebook is working, can set ...
0 votes
0 answers
180 views

Completely remove SVG icon load in child theme of Twenty Twenty-one theme

How to Completely remove SVG icon load in child theme of the Twenty Twenty-one theme?
10 votes
2 answers
743 views

Escaping and sanitizing SVGs in metabox textarea

I want to include inline SVGs in a metabox textarea. That's easy. What's killing me is how do I sanitize the textarea before saving the postmeta, and how do I escape it? Halp? Thanks!
0 votes
2 answers
1k views

SVG not displaying in Media Tab in Backend

I addes this code to allow SVG Uploads to the Media Library of wordpress: function upload_svg ( $svg_mime ){ $svg_mime['svg'] = 'image/svg+xml'; return $svg_mime; } add_filter( 'upload_mimes', '...
1 vote
2 answers
1k views

SVG Featured image not shown in twitter

I have a post with a featured image (size 736x212). The post url is this. I shared my post on twitter, but the tweet doesn't show the image (if you want to check click here). What could be the problem?...
0 votes
1 answer
334 views

Swap SVG icons in child themes

The Twenty Nineteen theme uses inline SVG for its icons instead of icon fonts. The icons are added to the HTML code with the TwentyNineteen_SVG_Icons::get_svg() function. public static function ...
0 votes
2 answers
218 views

SVG icons in Twenty Nineteen

The Twenty Nineteen theme uses SVG for its social icons. For example, this is the code for the Google icon: <svg viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="...
0 votes
1 answer
85 views

SVG Upload to WordPress Issue

So I added this code to my Functions.php file and all of a sudden I can upload SVG's across my entire server, all my clients websites. I know there are security disclaimers regarding using this code. ...
0 votes
0 answers
634 views

Create Gutenburg Block to render inline SVG

I have been creating custom Gutenberg blocks for projects and I want to create a simple block to add inline SVG code that renders in the block builder and the front-end. Would I create a element to ...
0 votes
1 answer
103 views

How can I change this SVG shape that's generated?

I have a website I'm customizing for a client, and I'll admit I'm not too skilled with generating SVGs. The site -- LINKED HERE uses a theme that has a built-in review feature and it currently uses a ...
0 votes
1 answer
26 views

Add a svg and show some text on the parts of that view when the user hover or click on that part in WordPress

I am working in my WordPress website and I want to add a svg to my website and show some text on the parts of that view when the user hover or click on that part in WordPress. I have searched a lot ...
0 votes
1 answer
514 views

Wordpress Block.js SVG createElement

I have an svg image I have created with the following code as example: <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 93.79 38.77"> <defs> <style&...
0 votes
2 answers
2k views

Expected an identifier and instead saw '<'

I am having difficulty adding a custom svg icon to my Wordpress Plugin, I read on this page https://developer.wordpress.org/block-editor/components/icon/ that to add a custom svg icon to my plugin for ...
0 votes
1 answer
1k views

SVG in list-style-image breaks when adding fill

I'm trying to add a custom bullet using CSS list-style-image. Here is the attribute: ul { list-style-image:url("data:image/svg+xml;utf8,<?xml version='1.0' encoding='utf-8'?><svg width='...
1 vote
1 answer
171 views

Insert SVG code (not img) in HTML block

I want to insert svg code in a Guttenberg HTML block. I don't want it as an image because I want to manipulate it with CSS. If I insert svg, all tag diseappears and I have only the text which was ...
0 votes
1 answer
75 views

import svg-files from wxr - (upload works, import not)

Upload works - Import from wxr not We're updating several sites with a new page, imported from a wxr file. Page, included form, jpg, png - all work fine but SVG not so much. I've checked scripts ...
1 vote
0 answers
56 views

Add other social networks to TwentyNineteen_SVG_Icons class in child theme?

I'm trying to add items to the $social_icons_map and $social_icons arrays in class-twentynineteen-svg-icons.php I know I need to do it in the functions.php file of my child theme. I think I need to ...
0 votes
1 answer
2k views

Add custom SVG icons to Social Icon MENU in WordPress Twenty Seventeen Child Theme

I'm having trouble adding custom SVG icons to the Social Icon Menu in WordPress Twentyseventeen Child Theme.The menu works fine with all pre-packaged SVGs included with the theme, but I can't add ...
3 votes
2 answers
2k views

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

I have enabled SVG uploads using this code: add_filter('upload_mimes', function($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; }); However, uploads of SVG files that start with the &...
0 votes
1 answer
455 views

Are SVG image files safe to upload? Why WP defines them as a security risk? [duplicate]

I'd like to upload a map of the USA in a SVG format however I am prevented from doing so because of a 'security risk'. Any ideas why this is? Is it safe to do so? Thanks
1 vote
1 answer
964 views

Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons

I’m trying to change the svg of the ellipses for the mobile menu. It’s called in this file: template-functions.php so I did a hook on my child theme functions.php to replace it, like so: function ...
0 votes
1 answer
27 views

Replace Home with image link inside custom header menu

What I want to achieve is a header menu like this: Right now, I have this: I am not far off. To get to where I am currently at, I followed these instructions and added some custom CSS. So I added ...
0 votes
1 answer
764 views

Wordpress search form and input type="image"

I need help with this code. How can I get the search field to display when clicking on the search-icon.svg? <form role="search" method="get" class="search-form" action="<?php echo home_url( '/...
2 votes
2 answers
3k views

SVG image upload stopped working

I have a client website that has the mime type support for SVG's added in the functions file. We've been uploading svg's for over a year. Suddenly it stopped working and is showing the "for security ...
0 votes
1 answer
5k views

Can you change the color of svg icons to the global color I choose from Wordpress

For example If I make svg icons that are grey and violet, when I change the global color scheme on wordpress, Is it possible to make it work so if the main color scheme was violet, and I change the ...