Black Friday 40% off the first year of every plugin. Use code BLACKFRIDAY40

Skip to content

How to Add and Customize WordPress Icons: 4 Methods Tested

How to Add and Customize WordPress Icons: 4 Methods Tested

WordPress icons are small vector graphics that you add with a block, an inline SVG, or an icon font. The fastest route in WordPress 7.1 is the core Icon block, which takes about a minute per icon.

I tested every method in this guide in October 2026 on a WordPress 7.1.3 test site with WooCommerce 11.2 active. I added each icon, loaded the page as a logged-out visitor, and measured the files each method sends.

You get four methods with steps and screenshots: the Icon block, the Social Icons block, SVG code, and icon fonts. A chart near the end shows what each one adds to a page.

What Are WordPress Icons?

WordPress icons are small graphics that mark a button, a link or a feature, such as a cart or a heart. They reach a page as SVG code, an icon font, or a plain image file. The built-in icon set arrived with WordPress 7.0, and 7.1 added a public API for your own icons.

SVG fits most sites best. It stays sharp at any size and takes its color from CSS. Inline SVG also needs no extra request, because the code sits inside the page.

An icon font does the same job with a font file instead. A plain image such as a PNG cannot change color with CSS, so it suits logos more than interface icons.

Do not confuse these with the site icon, the small image in a browser tab. That one is a separate setting, covered in our guide to changing the favicon in WordPress.

You can add icons to WordPress with any of four methods, and the right one depends on the job. This chart maps five common jobs to the method I would pick for each.

Which method to use for WordPress icons by job

If you would rather hand page design to a tool, our roundup of the best WordPress AI website builders compares the options.

How to Add Icons in WordPress with the Icon Block

You add an icon with the core Icon block in four steps. Insert the block, pick an icon from the library, set its color and size, then add a label for screen readers. No plugin is needed on WordPress 7.0 or later.

The block reference lists support for color, width, spacing, shadow and an ARIA label. That list is the whole customization surface, so each step below covers one part of it.

Step 1: Insert the Icon Block

Open a page or post and click the block inserter. Search for “icon” and pick Icon, not Social Icons. A default info icon appears in the block.

Typing /icon on an empty line does the same job without the inserter.

Block inserter search showing the Icon block
Screenshot from our WordPress 7.1 test site

Step 2: Pick an Icon from the Library

Select the block and click Replace in the toolbar. The Icon library opens, and a search box filters it by name. Type “cart” and click the icon.

Our test site lists one collection called WordPress, with 88 icons. None of them is a brand logo, so there is no Facebook or Instagram icon in this library. The Social Icons block covers those, and the next section shows how.

Icon library with the Cart icon found by search
Screenshot from our WordPress 7.1 test site

Step 3: Change the Color and Size

Open the Styles tab in the block sidebar. The Color control under Typography sets the icon color, and the Width field under Dimensions sets its size in pixels. I picked the theme’s purple and a width of 72 px.

The block’s own stylesheet sets fill: currentColor, so the Typography color tints the whole shape. The Background color, spacing and shadow controls work the same way.

Icon block color and width settings in the sidebar
Screenshot from our WordPress 7.1 test site

Step 4: Add a Label for Screen Readers

Open the Settings tab and type a short description in the Label field, such as “Shopping cart”. Leave it empty when the icon is pure decoration. The toolbar also holds Flip horizontal, Flip vertical and Rotate buttons.

Icon block label field and the flip and rotate buttons
Screenshot from our WordPress 7.1 test site

The block is dynamic, so WordPress saves one comment in the post and builds the SVG when the page loads. This is the saved block after my changes:

<!-- wp:icon {"icon":"core/cart","flipHorizontal":true,"rotation":90,"style":{"elements":{"link":{"color":{"text":"var:preset|color|accent-3"}}},"dimensions":{"width":"72px"}},"textColor":"accent-3","ariaLabel":"Shopping cart"} /-->

The rendered SVG starts like this, shortened:

<svg style="color:var(--wp--preset--color--accent-3);width:72px; rotate: 90deg;" aria-label="Shopping cart" class="has-text-color has-accent-3-color is-flip-horizontal" role="img">

The core library stops at 88 icons, which is a real limit for a branded site. If you want a custom icon set built into your theme, our custom WordPress development team can build it.

How to Add Social Media Icons to WordPress

You add social media icons with the core Social Icons block. Open the Header in the Site Editor, insert the block, add each profile, and paste its URL. The same steps work in a footer, a page or a post.

The Social Icons block reference lists three styles and the options for icon size, visible text and new tabs. Facebook, X, Instagram and YouTube are all built in.

Step 1: Add the Social Icons Block to Your Header

On a block theme, you add social media icons to the WordPress header in the Site Editor. Go to Appearance, then Editor, then Patterns, and open the Header under Template parts. Select the Navigation block, open the inserter, and search for “social icons”.

The block lands right after the selected block, so it sits next to your menu.

Block inserter showing the Social Icons block for the header
Screenshot from our WordPress 7.1 test site

Step 2: Add Each Profile

Click the plus button inside the Social Icons block. A picker lists services alphabetically, starting with WordPress, 500px and Amazon.

Type a name such as “inst” to filter the list, then click Instagram. Repeat for each network you use.

Social Icons service picker filtered to Instagram
Screenshot from our WordPress 7.1 test site

Step 3: Paste the Profile URL

Click the new icon in the canvas and a link field opens. Paste the full profile URL and press Enter. Press Escape before you add the next service, or the next URL can land in the wrong icon.

I also left one icon without a URL to see what happens. The editor shows it, but the live page prints an empty list, so fill in every URL.

Profile URL field for a social icon
Screenshot from our WordPress 7.1 test site

Step 4: Set the Size and the New Tab Option

Select the parent Social Icons block, then open the Settings tab. The Icon size menu sets the size. Show text prints each network name beside its icon, and Open links in new tab does what it says.

Social Icons size menu and new tab toggle
Screenshot from our WordPress 7.1 test site

People often ask what size social media icons should be. In our test, the four sizes drew a glyph of 16, 24, 36 and 48 px for Small, Normal, Large and Huge. The clickable area is 24, 36, 54 and 72 px wide.

With Open links in new tab on, the saved link opens in a new tab and carries the rel values noopener and nofollow. The block hides each network name from sighted visitors and keeps it as screen reader text.

Step 5: Change the Style and the Color

Open the Styles tab to change the social media icons. Default draws a colored circle per network, and Logos Only drops the circle. Pill Shape is the third option.

The Icon color and Icon background controls recolor all of them at once.

I chose Logos Only with the theme’s purple, and the live header shows the result.

Social Icons style options and icon color control
Screenshot from our WordPress 7.1 test site
Social icons in the WordPress header using the Logos Only style
Screenshot from our WordPress 7.1 test site

Can You Upload SVG Icons to WordPress?

Not by default. WordPress 7.1.3 rejects an SVG file in the Media Library with the message “Sorry, you are not allowed to upload this file type.” Paste the SVG code into a Custom HTML block instead, or register it as an icon.

I uploaded a small heart SVG on the Add Media File screen to confirm it. That limit means SVG icons in WordPress reach a page as code.

WordPress Media Library error when uploading an SVG file
Screenshot from our WordPress 7.1 test site

Inline SVG is the workaround that needs no plugin. Draw the icon in a design tool, export it, and open the file in a text editor to copy its markup. Check the license of any icon set before you use it.

Then add a Custom HTML block and paste the markup. My heart icon was 284 bytes and rendered at once.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor" aria-hidden="true"><path d="M12 21s-7.5-4.6-9.6-9.2C.9 8.5 2.7 5 6.1 5c2.1 0 3.6 1.2 4.4 2.5.3.5.7.5 1 0C12.3 6.2 13.8 5 15.9 5c3.4 0 5.2 3.5 3.7 6.8C19.5 16.4 12 21 12 21z"/></svg>

Set fill="currentColor" so the text color around the icon tints it. Add aria-hidden="true" when the icon only decorates.

Sprite sheets help when one icon repeats. You define the shape once in a symbol element and reuse it with a use element. I tested it in a Custom HTML block, and all five uses rendered.

<svg style="display:none"><symbol id="ps-heart" viewBox="0 0 24 24"><path d="M12 21s-7.5-4.6-9.6-9.2C.9 8.5 2.7 5 6.1 5c2.1 0 3.6 1.2 4.4 2.5.3.5.7.5 1 0C12.3 6.2 13.8 5 15.9 5c3.4 0 5.2 3.5 3.7 6.8C19.5 16.4 12 21 12 21z"/></symbol></svg>
<svg width="24" height="24" aria-hidden="true"><use href="#ps-heart"/></svg>

The savings are small for one icon, and a sprite is bigger there: 315 bytes against 284 for plain inline SVG. With the same icon used 20 times, the page carried 1,759 bytes with the sprite and 5,680 bytes inline.

How to Register Your Own Icons in WordPress 7.1

WordPress 7.1 lets a plugin or theme register its own icons with wp_register_icon_collection() and wp_register_icon(). Registered icons then appear in the Icon block library under your collection name. Each icon needs a label and either an inline SVG string or a path to an SVG file.

The WordPress core team’s guide says to call both functions on the init hook and to register the collection first. Icon names take the form collection/icon-name.

This is the code I used in a small plugin. The icon file sits in an icons folder next to the plugin file.

add_action( 'init', function () {
	wp_register_icon_collection( 'pixelshop', array( 'label' => 'Pixel Shop' ) );
	wp_register_icon( 'pixelshop/heart', array(
		'label'     => 'Heart',
		'file_path' => plugin_dir_path( __FILE__ ) . 'icons/heart.svg',
	) );
} );

The new Pixel Shop collection showed up in the Icon library next to WordPress. Registered icons then follow the same Step 2 to Step 4 routine as core icons.

Icon library listing a custom Pixel Shop icon collection
Screenshot from our WordPress 7.1 test site

Registered SVG content passes through a strict filter. The core team’s guide says only the svg, path and polygon elements survive, and strokes are not allowed. I registered a stroke-based heart outline to test this, and it came back as a solid heart, as the second icon in the screenshot shows.

So convert outline icons to filled shapes before you register them. To print a registered icon in a theme template, call wp_get_icon() with a size and a label. It returns an empty string for an unknown name.

echo wp_get_icon( 'pixelshop/heart', array( 'size' => 32, 'label' => 'Wishlist' ) );

WordPress Icon Fonts vs SVG Icons: Font Awesome and Dashicons Tested

An icon font draws every icon from one font file, while SVG icons sit inline in the page. In our test, the Font Awesome plugin added four requests and about 171 KB, and inline SVG added none. Dashicons did not load for visitors at all.

The chart below sums up what I measured for the three methods on the same test page.

Requests and weight added by three WordPress icon methods

Add Icons with the Font Awesome Plugin

Install the Font Awesome plugin from the Plugins screen and open Settings, then Font Awesome. The defaults were Use CDN, Free icons, Web Font and version 7.3.1. Older Version Compatibility was on.

The Font Awesome WordPress documentation lists two ways to place an icon. Use the Font Awesome Icon block and its Choose Icon button, or paste an icon tag with the classes fa-solid fa-heart into a Custom HTML block. My test used the tag, because the block embeds SVG instead of loading the font.

Here is what a visitor downloaded on the test page:

  • Plugin stylesheet: svg-with-js.css weighed 25.6 KB.
  • Icon stylesheet: all.css weighed 22.3 KB compressed.
  • Compatibility file: v4-shims.css weighed 4.1 KB compressed.
  • Font file: fa-solid-900.woff2 weighed 119.5 KB.

That is 171 KB for one heart. Every added plugin also counts toward your plugin total, a question we cover in whether 50 plugins is too much for a WordPress eShop.

Font Awesome plugin settings using the free CDN
Screenshot from our WordPress 7.1 test site

Why Dashicons Do Not Show for Visitors

Dashicons is the official icon font of the WordPress admin. Its stylesheet did not load for logged-out visitors in my test. A dashicons class on a span therefore printed nothing.

My test page had three icons: a Font Awesome heart, a Dashicons heart and an inline SVG heart. Only the Dashicons line stayed empty for a logged-out visitor.

Dashicons missing on the front end while Font Awesome and SVG icons render
Screenshot from our WordPress 7.1 test site

Enqueue the stylesheet to fix it. After I added the line below, the icon showed and the page loaded one extra file, dashicons.min.css, at 59 KB.

add_action( 'wp_enqueue_scripts', function () {
	wp_enqueue_style( 'dashicons' );
} );

My advice is to skip both fonts on a new build. The Icon block and inline SVG cost less, and they work for every visitor with no plugin.

How to Customize WordPress Icons with CSS

You customize an icon with CSS by targeting its SVG element. Set color to change the shade, width to change the size, and transition to animate the change. Add the rules under Styles, then Additional CSS, and give the block a CSS class so they touch only that icon.

Select the Icon block, open the Advanced panel in its sidebar, and type shop-heart into the Additional CSS class field. Then paste this CSS under Styles, Additional CSS.

.shop-heart svg {
	width: 48px;
	color: #503aa8;
	transition: all 0.2s;
}
.shop-heart:hover svg {
	color: #0256ff;
	transform: scale(1.15);
}

On the live page, the heart read rgb(2, 86, 255) under the pointer and its transform matrix scaled it by 1.15. The same rules work on an inline SVG that uses currentColor.

Keep motion small, and wrap larger effects in a prefers-reduced-motion check so visitors who turn animation off do not see them. A scale of 1.15 over 0.2 seconds is gentle enough for most visitors.

A CSS mask is a fourth way to draw an icon without markup. You point mask at an SVG file and paint the shape with background. MDN marks the property as widely available in browsers.

.mask-heart {
	width: 48px;
	height: 48px;
	background: #0256ff;
	mask: url(/wp-content/uploads/heart.svg) center / contain no-repeat;
}

The mask rendered a filled heart in my test. Our own theme draws its arrow marks this way.

The theme keeps its social icons in one PHP function as inline paths. Each path uses currentColor, so the link color tints the icon.

Accessibility Labels and Performance Checks for WordPress Icons

Give every icon that carries meaning a text label, and hide the ones that only decorate. The Icon block does this for you: no label writes aria-hidden="true", and a label writes role="img" with an aria-label. For performance, inline SVG adds no request, and a sprite sheet saves bytes only when you repeat one icon often.

The W3C says decorative images should be skipped by screen readers with an empty alternative. An icon beside visible text is decorative. An icon alone in a button needs a name, such as “Add to wishlist”.

The Social Icons block already handles this. In our test, each icon carried aria-hidden="true" and a hidden text label with the network name, so a screen reader announced “Facebook” and skipped the drawing.

Run through this short list after you add icons:

  • Labels: Every icon-only link or button has a name a screen reader can read.
  • Contrast: The icon color stands out from its background.
  • Requests: The page loads no icon font you do not use.

Our guides to a web accessibility audit and to reducing HTTP requests in WordPress cover the wider checks.

Conclusion

WordPress icons are now a core feature. Use the Icon block for single icons, the Social Icons block for profile links, and inline SVG for anything else. Reach for an icon font only when you need a large library on every page.

Test the page as a logged-out visitor before you publish, because a missing stylesheet shows up only there. If you also plan to add AI features to your site, our guide to AI integration with WordPress is the next read.

Frequently Asked Questions (FAQs)

Q1. Which WordPress version has the Icon block?

The built-in icon set and block arrived with WordPress 7.0. WordPress 7.1 added functions to register your own icons, according to the core team’s announcement. Older versions need a plugin or inline SVG.

Q2. What size should social media icons be?

In our test, the Social Icons block drew glyphs of 16, 24, 36 and 48 px for its four sizes. Normal at 24 px suits a header, and Large at 36 px suits a footer or a contact page.

Q3. Are Font Awesome icons free in WordPress?

Yes, a free set exists. The plugin has a Free option, and the Font Awesome documentation says the CDN setup can search and add Free icons only. Pro icons need a Pro Kit.

Q4. Do icons slow down a WordPress site?

An inline SVG adds under 1 KB and no request. Our test of the Font Awesome plugin added four requests and about 171 KB. Judge a method by the files it loads.

Q5. How do I make social media icons open in a new tab?

Select the Social Icons block, open the Settings tab, and turn on Open links in new tab. WordPress then opens every link in the block in a new tab. One setting covers every icon.

Q6. How do I change an icon’s color when someone hovers over it?

Give the Icon block a CSS class, then add a :hover rule for its SVG under Styles, then Additional CSS. Set the color property in that rule. The CSS section above shows a tested example.

Yash Kapoor
Yash Kapoor

Yash Kapoor is the founder and WordPress expert at DevDiggers, where he builds WordPress and WooCommerce plugins for loyalty programs, point-of-sale systems, digital wallets and affiliate management. He writes about developer tools, site performance and the technical side of running a WordPress store. He draws on years of building and maintaining production plugin codebases.

Leave a Reply

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