How to add a Custom Theme Logo in WordPress

Erika in Glasses
2 min readNov 2, 2016

I’m writing this after I realized that the Codex only gives you half the steps and not really in that great of detail for people new to WordPress.

This is what the Codex gives you:

Step 1:

Open your function.php file in your theme folder and locate this line:

add_theme_support( 'custom-logo' );

Replace it with this:

add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );

This gives the logo a set width and height, which you can change, it also states that the width and height can be flexible based on the actual image file so that you don’t get a warped image.

Step 2:

Open the file where you want the theme logo to appear and add this code:

$custom_logo_id = get_theme_mod( 'custom_logo' );
$image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
echo $image[0];

But you need to change it a little… which the Codex leaves out

$custom_logo_id = get_theme_mod( 'custom_logo' );
$image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
<img src="<?php echo $image[0]; ?>" alt="">

That’s all the CodeX tells you.

But where do you upload the actual file? If you haven’t updated this in a theme before and/or new to making themes it isn’t really obvious.

Step 3:

3.a Go to your wp-admin, go to Appearances, and then Customize.

3.b Click on Site Identity

3.c Upload/Change the logo (this is also where you can can upload a favicon — Site Icon)

Step 4:

Click on the Save & Publish button in the top of the side bar.

Step 5:

Refresh the page and there it is!

Okay bye!



Erika in Glasses

Web developer. Twitch Affiliate (erikainglasses). Youtuber. Olympic lifter. I write about code and streamer.