Skip to content
  • Log In
  • Register
WordPress.org
  • News
  • Showcase
  • Hosting
    • Themes
    • Plugins
    • Patterns
    • Blocks
    • Openverse ↗︎
    • Learn WordPress
    • Documentation
    • Forums
    • Developers
    • WordPress.tv ↗︎
    • Make WordPress
    • Photo Directory
    • Five for the Future
    • Events
    • Job Board ↗︎
    • About WordPress
    • Enterprise
    • Gutenberg ↗︎
  • Get WordPress
Get WordPress
WordPress.org

Make WordPress Core

  • Tickets
  • Components
  • Handbook
  • Browse Source
  • Trac Timeline
  • Create a New Ticket
  • Log in
  • Tickets
  • Components
  • Handbook
  • Browse Source
  • Trac Timeline
  • Create a New Ticket
  • Log in
Menu

Welcome!

The WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. development team builds WordPress! Follow this site for general updates, status reports, and the occasional code debate. There’s lots of ways to contribute:

  • Found a bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority.? Create a ticket in the bug tracker.
  • Want to contribute? Get started quickly with tickets marked as good first bugs for new contributors or join a bug scrub. There’s more on the reports page, like patches needing testing, and on feature projects page.
  • Other questions? Here is a detailed handbook for contributors, complete with tutorials.

Communication

Core uses Slack for real-time communication. Contributors live all over the world, so there are discussions happening at all hours of the day.

Core development meetings are every Wednesday at 15:00 UTC in the #core channel on Slack. Anyone can join and participate or listen in!

      Konstantin Obenland 5:57 pm on March 10, 2016
      Tags: 4.5 ( 60 ), custom-logo, dev-notes ( 572 )   

      Custom Logo

      New in 4.5 is the ability for users to add a logo to their sites (if their theme has declared support for it). It’s an addition to the Custom HeaderHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. and Custom Background features which themes have to declare support for as well, and works pretty much just like them.

      To register support, a theme would add the following call in a callback to the after_setup_theme action:

      function theme_prefix_setup() {
      	add_theme_support( 'custom-logo' );
      }
      add_action( 'after_setup_theme', 'theme_prefix_setup' );
      

      Theme support for custom logos accepts five parameters, added in an arguments array:

      • height
        (int) Expected logo height in pixels.
        Themes can use built-in image sizes (like thumbnail) or register a custom image size and use that.
      • width
        (int) Expected logo width in pixels.
      • flex-height
        (boolean) Whether to allow for a flexible height.
        Showing the logo in a vertical sidebarSidebar A sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or any where in the theme. (like Twenty Fifteen) is a good example for when a flexible height can make sense.
      • flex-width
        (boolean) Whether to allow for a flexible width.
        If a theme has room horizontally, flex-width gives users more freedom in how their logo can be displayed. Example:
        add_theme_support( 'custom-logo', array(
           'height'      => 175,
           'width'       => 400,
           'flex-width' => true,
        ) );
        
      • header-text
        (array) Class name(s) of elements to hide.
        This parameter is only important for (the very few) themes that do not also support hiding the header text in custom headers. Themes can pass an array of class names here for all elements constituting header text that could be replaced by a logo.
        add_theme_support( 'custom-logo', array(
           'header-text' => array( 'site-title', 'site-description' ),
        ) );
        

      Not only will this enable the CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. control to add a custom logo, it will also add a body class of wp-custom-logo that can be used to style the logo if present. Important: When adding support in your theme, please make sure to test setting a new logo in the customizer with your theme active and in Live Preview. You also want to make sure that the theme has styles in place to accommodate logos that don’t have your custom image size (if you chose to add one), like images that have been uploaded before your theme was activated or updated, since they default to the full size.

      To manage displaying a custom logo in the front-end, these three template tags can be used:

      • get_custom_logo( $blog_id = 0 )
        Returns markup for a custom logo.
      • the_custom_logo( $blog_id = 0 )
        Displays markup for a custom logo.
      • has_custom_logo( $blog_id = 0 )
        Returns a boolean true/false, whether a custom logo is set or not.

      To be able to use the new template tags and maintain backwards compatibility with older versions of WordPress it is recommended to wrap these functions in a function_exists() call, similar to how Twenty Sixteen does it:

      function twentysixteen_the_custom_logo() {
         if ( function_exists( 'the_custom_logo' ) ) {
            the_custom_logo();
         }
      }
      

      The latest two default themes will be updated with support for this brand new feature as soon as WordPress 4.5 ships. Themes that have been using Jetpack’s Site Logo implementation will not need to be updated—Jetpack will do a migrationMigration Moving the code, database and media files for a website site from one server to another. Most typically done when changing hosting companies. behind the scenes to work with it out of the box.

      A small under the hood goodie: Custom logos utilizes the Customizer’s brand new Selective Refresh feature, allowing for super fast changes without having to reload the entire preview. It also let’s users shift-click the logo in the preview to open the corresponding customizer section.

      [EDIT]: As of [37077], Custom Logo does not support the size argument anymore. Specifying the logo size in individual arguments has the advantage of only creating a special image file for the specific logo used (and not every image uploaded), and providing more parity with how Custom HeaderHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. works.

      #4-5, #custom-logo, #dev-notes

      Share this:

      • Click to share on Threads (Opens in new window) Threads
      • Click to share on Mastodon (Opens in new window) Mastodon
      • Click to share on Bluesky (Opens in new window) Bluesky
      • Click to share on X (Opens in new window) X
      • Click to share on Facebook (Opens in new window) Facebook
      • Click to share on LinkedIn (Opens in new window) LinkedIn
          1. sidati 6:11 pm on March 10, 2016

            Nice implementation, Great Feature (y)

          2. sinan isler 6:40 pm on March 10, 2016

            good start
            we need to make a very good default theme next time for logo and better customizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. examples.

          3. francgrasso 7:52 pm on March 10, 2016

            step by step the customization of wordpress is growing up! Keep continue guys!

          4. Dan Boulet 9:59 pm on March 10, 2016

            This would be much more useful if it supported SVG logos.

          5. leemon 10:18 pm on March 10, 2016

            great feature!

          6. Ahmad Awais 1:41 am on March 11, 2016

            Good one!

          7. Morten Rand-Hendriksen 2:35 am on March 11, 2016

            Looks great. I’m building this into Popper so the feature is ready when 4.5 comes out.

          8. Guido Scialfa 3:21 pm on March 12, 2016

            No way to hooking for size before wp_get_attachment_image function call. Will be very helpful in case a theme don’t provide own size or some customer try to add large images.

            One question, how this work with responsive images?

            • Konstantin Obenland 5:16 pm on March 24, 2016

              It uses wp_get_attachment_image() and all the responsive images magic that comes with it.

          9. erichmond 8:30 am on March 15, 2016

            Nice work! Can’t wait to start implementing this it’s been a long time coming.

          10. Tomas Mackevicius 6:54 am on March 24, 2016

            What would be the best way to add additional BODY class .has-site-logo to make this compatible with child themes that are using this old class? Thank you!

            • Konstantin Obenland 5:17 pm on March 24, 2016

              Probably through a callback to body_class. Jetpack might do that for you as well, it could be worth looking into that.

              • Tomas Mackevicius 7:52 pm on March 24, 2016

                You see, for several years I was recommending to users stand-alone pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party, that only later was merged into Jetpack, for that reason there will be users that will not get that compatibility update via Jetpack. I also checked Site logo code in recnt Jetpack version, but didn’t find any checking function that would append old class name.

                I know how to add class via body_class, but I don’t know how to check if logo is assigned. I cannot use `if ( function_exists( ‘the_custom_logo’ ) )` because it would fall to “True” even if logo is not assigned.

                Thank you for helping!

                • Konstantin Obenland 1:09 am on March 30, 2016

                  You could check for function_exists( 'has_custom_logo' ) && has_custom_logo().

                  • Tomas Mackevicius 9:08 pm on March 30, 2016

                    Thank you!!!

          11. Mike 1:54 pm on April 2, 2016

            How can I get rid of inline height and width?

            I put this in functions.php

            add_theme_support( 'custom-logo', array(
            	'flex-width' => true,
            	'flex-height' => true,
            ) );
            

            and get this

            <img width="464" height="76" src="http://url/logo_color.png" class="custom-logo" alt="logo_color">
            

            I don’t want these “width=”464″ height=”76″”. And when I style logo with

            .custom-logo-link img {
              height: 3em;
              width: auto;
            }
            

            it gets distorted anyway.

            • Konstantin Obenland 9:16 am on April 11, 2016

              What is it exactly you’d like to achieve? I’m sure the logo needs some kind of restriction to not take over the entire site?

          12. dailyreup 2:22 pm on April 13, 2016

            How can we change the default class on the anchor and image if we do need to change it? When we use `the_custom_logo()` ?

            • Konstantin Obenland 4:33 pm on April 13, 2016

              With the current APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. that is not possible. Not sure I see a use case for it either given the myriad of selector possibilities nowadays.

              • Pixelatic 2:38 pm on April 20, 2016

                One common use case is http://getbootstrap.com/components/#navbar-brand-image, where Bootstrap expects a .navbar-brand class to be present on logo images.

                It would be helpful to be able to pass additional classes as arguments to the_custom_logo(), currently I have to add the class via jQuery once the page is loaded:

                $(‘.custom-logo-link’).addClass(‘navbar-brand’);

                • Freckles Liker 3:49 pm on April 25, 2016

                  Dont understand why not to add class parameter or even walker for this.
                  This will be helpful for some UIUI User interface Kits.
                  Now i found solution with simple filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output.:

                  add_filter('get_custom_logo', 'custom_logo_output', 10);
                  function custom_logo_output( $html ){
                  $html = str_replace( 'custom-logo-link', 'custom-logo-link any-class-you-want', $html );
                  return $html;
                  }

                  • dailyreup 4:22 pm on May 20, 2016

                    Awesome. Thanks guys for your input. It would be nice if it would just come w/ options we can just change rather than using a filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output.. Maybe we can add this new feature in the future?

          13. David Morgan 4:20 pm on April 13, 2016

            Is there a way to register a default logo image, similar to how default headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. images are registered? This would be a nice feature for theme developers that want the logo of their theme displayed by default when the theme is activated.

            • Konstantin Obenland 4:31 pm on April 13, 2016

              There is not and frankly I’m not unhappy about that. Folks prefer to use their own logos on their sites, not the theme author’s.

          14. dtbaker 5:05 am on April 19, 2016

            Default logo:

            add_filter('get_custom_logo',function($html){
               if(empty($html)){ $html = ''; }
               return $html;
            });
            
          15. Anonymous User 3:04 pm on April 30, 2016

            I just tried this new feature in the twenty fifteen theme.
            The chosen image will be cropped to a max of 248px*248px. That is very small and does look mushy especially on modern hig-res smartphones. Will the image size be increased in the future?

            • Konstantin Obenland 4:01 pm on May 2, 2016

              There is a ticketticket Created for both bug reports and feature development on the bug tracker. to create a 2x image size for HiRes displays that tries to achieve that: https://core.trac.wordpress.org/ticket/36191

          16. LewisCowles 9:25 am on May 17, 2016

            The implementation is one of the worst things the coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. WP team has done…

            used to be able to display custom types, within customizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings., now it shows a generic image and tries to force crop… needless and petty!

            • Konstantin Obenland 3:51 pm on May 17, 2016

              Can you expand on what kind of custom types you were able to display?

          17. kombak 4:20 pm on May 17, 2016

            Is there a way, to make it rotate the Site Image based on a gallery, or something like that?

            • Konstantin Obenland 4:22 pm on May 17, 2016

              There is not, but that sounds like a neat idea for a pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party!

              • kombak 6:27 pm on May 17, 2016

                Ha ha, Thanks, that is what I was afraid of! Guess I will start writing a new pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party….

          18. hector_ua 9:00 pm on May 24, 2016

            Hello. is there any way to get just custom logo URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org, not a whole img tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.)?

            • titanium009 1:15 pm on June 2, 2016

              Did you get any solution? I am seeking the same !

              • titanium009 2:21 pm on June 2, 2016

                I just solved it. Try this code:

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

                • hector_ua 7:55 pm on June 6, 2016

                  yeah, thx, it works, but so sad that there no such elegant solution like for headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. image (get_header_image());
                  But defenetly i’ll use it!

                  • acalfieri 12:45 pm on June 9, 2016

                    With wp_get_attachment_image_url() you can skip a couple of steps.
                    $image = wp_get_attachment_image_url( get_theme_mod( ‘custom_logo’);

          Comments are closed.

          Post navigation

          ← Dev Chat notes for March 9
          Customizer Improvements in 4.5 →

          Site resources

          Email Updates

          Enter your email address to subscribe to this blog and receive notifications of new posts by email.

          Join 6,389 other subscribers
          • Recent Updates
          • Recent Comments
          • No Replies

          Current Release

          The current release in progress is WordPress 6.9. Planned future releases are listed on the Project Roadmap. Feature projects not tied to specific releases can be found on the Features page.

          Regular Chats

          Note: All chats happen on Slack.
          • Weekly Developer Meetings: Wednesday 15:00 UTC in #core
          • About the Dev Chat
          • Agendas | Summaries

          • Performance Weekly Chat Tuesday 15:00 UTC in #core-performance
          • New Contributors Chat
            The 2nd and 4th Wednesday of every month at 19:00 UTC in #core

          See all meetings →

          Recent Posts and Comments

          Team Pledges

          2442 people have pledged time to contribute to Core Team efforts! When looking for help on a project or program, try starting by reaching out to them!

          • About
          • News
          • Hosting
          • Privacy
          • Showcase
          • Themes
          • Plugins
          • Patterns
          • Learn
          • Documentation
          • Developers
          • WordPress.tv ↗
          • Get Involved
          • Events
          • Donate ↗
          • Five for the Future
          • WordPress.com ↗
          • Matt ↗
          • bbPress ↗
          • BuddyPress ↗
          WordPress.org
          WordPress.org
          • Visit our X (formerly Twitter) account
          • Visit our Bluesky account
          • Visit our Mastodon account
          • Visit our Threads account
          • Visit our Facebook page
          • Visit our Instagram account
          • Visit our LinkedIn account
          • Visit our TikTok account
          • Visit our YouTube channel
          • Visit our Tumblr account
          Code is Poetry
          s
          search
          c
          compose new post
          r
          reply
          e
          edit
          t
          go to top
          j
          go to the next post or comment
          k
          go to the previous post or comment
          o
          toggle comment visibility
          esc
          cancel edit post or comment