A custom logo can be displayed in the theme using the_custom_logo() function. But it’s recommended to wrap the code in a function_exists() call to maintain backward compatibility with the older versions of WordPress, like this:
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
Generally logos are added to the header.php file of the theme, but it can be elsewhere as well.
If you want to get your current logo URL (or use your own markup) instead of the default markup, you can use the following code: