Custom Theme functions.php – Using add_settings_field and input type=”file” to set custom logo

The examples you’ve seen are out of date. From WordPress 4.5, released in 2016, the proper way to support a custom logo was to register support for the Custom Logo feature in your theme.

That link has the full documentation, but the short version is that you use this code to enable the standard logo field in the Customiser:

add_theme_support( 'custom-logo' );

Then you can output the selected logo in the theme with:


In the modern Block themes no code is necessary; the user can add their logo by using the Site Logo block.