2022 Developer Survey is open! Take survey.

Questions tagged [svg]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
232 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?
user avatar
0 votes
1 answer
30 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 ...
user avatar
0 votes
2 answers
40 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....
user avatar
0 votes
1 answer
137 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\...
user avatar
  • 3
0 votes
1 answer
106 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 ...
user avatar
0 votes
0 answers
13 views

How should SVG icons best be applied to user-entered content?

Replacing icon fonts with inline SVG icons seems to be strongly recommended by many developers these days. That makes sense for icons that can be hardcoded in theme files. But what about those that ...
user avatar
  • 41
0 votes
1 answer
186 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 ...
user avatar
0 votes
1 answer
227 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 ...
user avatar
  • 403
0 votes
1 answer
127 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 ...
user avatar
  • 1,085
0 votes
1 answer
75 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"=> &...
user avatar
  • 1
1 vote
0 answers
119 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 ...
user avatar
  • 11
0 votes
0 answers
119 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?
user avatar
  • 858
0 votes
1 answer
1k 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 ...
user avatar
0 votes
2 answers
737 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', '...
user avatar
  • 53
2 votes
1 answer
2k 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 ...
user avatar
0 votes
1 answer
2k 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
user avatar
  • 25
0 votes
2 answers
198 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="...
user avatar
  • 1,607
0 votes
1 answer
52 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. ...
user avatar
0 votes
1 answer
265 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 ...
user avatar
  • 1,607
0 votes
0 answers
490 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 ...
user avatar
0 votes
1 answer
91 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 ...
user avatar
  • 119
2 votes
1 answer
540 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 ...
user avatar
0 votes
1 answer
367 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&...
user avatar
0 votes
2 answers
1k 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 ...
user avatar
1 vote
1 answer
65 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 ...
user avatar
  • 136
0 votes
1 answer
53 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 ...
user avatar
  • 23
0 votes
1 answer
762 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='...
user avatar
  • 167
1 vote
0 answers
53 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 ...
user avatar
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 ...
user avatar
  • 293
1 vote
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 &...
user avatar
  • 148
0 votes
1 answer
414 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
user avatar
  • 985
1 vote
1 answer
894 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 ...
user avatar
0 votes
1 answer
22 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 ...
user avatar
0 votes
1 answer
26 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 ...
user avatar
  • 135
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?...
user avatar
4 votes
1 answer
678 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 ...
user avatar
  • 143
0 votes
1 answer
605 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( '/...
user avatar
  • 21
7 votes
6 answers
12k 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'; ...
user avatar
  • 183
0 votes
1 answer
1k 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 ...
user avatar
4 votes
2 answers
2k 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 =...
user avatar
  • 913
5 votes
1 answer
562 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>...
user avatar
0 votes
1 answer
4k 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 ...
user avatar
1 vote
2 answers
1k views

How to implement my own icons instead of using the svg icon system

From WordPress 4.9.2, I created a child theme for twentyseventeen. I noticed that it comes with its own SVG icon system for social media icons at the bottom of the page. I see some of that code ...
user avatar
  • 708
1 vote
2 answers
2k views

Disable automatig SVG tag from menu

I'm using twentyseventeen theme as base to design my own, but when i use wp_nav_menu to print menus, it adds some unwanted svg elements which break my design. Elements are like: <svg class="icon ...
user avatar
10 votes
2 answers
601 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!
user avatar
4 votes
2 answers
12k views

How to Include SVG sprites icons into the body tag? [closed]

I want to include an SVG icon file after the body tag and I'm using this code: <?php include_once("assets/img/sprites.svg"); ?> But I get this error: Parse error: syntax error, unexpected ...
user avatar
  • 143
2 votes
1 answer
1k views

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

My question is about how to attached the size dimensions I have successfully extracted from an SVG and force them into the WP 'dimensions' field associated with the file, so that the dimensions appear ...
user avatar
7 votes
2 answers
5k views

Can't extract and set SVG dimensions

Up to now, I have had no problems with the background-image thumbnails in my theme. However, now that I'm trying to use an SVG as the featured image, something is breaking. The problem seems to ...
user avatar
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 ...
user avatar
  • 133
5 votes
2 answers
9k views

Cant upload SVG files after updating Wordpress 4.7.1 [duplicate]

I updated Wordpress to 4.7.1 and cant upload SVG anymore. I had a function in my functions.php file function cc_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } ...
user avatar