Provide logo in theme

I'm doing some small updates to a WordPress site which is managed as a git repository. The deployment process goes something like, commit to git, push to git repo, ssh to the instance, do a git pull.

Now how can I update the site logo? The theme header is using the_custom_logo() and so from what I can tell this file has to be uploaded. The site and git repo already has a bunch of things in wp-content/uploads which is where the current logo is but just putting a file in here doesn't mean it has an ID or other metadata right?

I'm confused how the person before me did this. Is there a way to just add the logo to the site files and have the site update automatically?

Ideally I'd like to keep using the_custom_logo() because it does a bunch of stuff that I would rather not duplicate and have to keep up to date with upstream.

Topic logo uploads git Wordpress

Category Web


Now how can I update the site logo? The theme header is using the_custom_logo() and so from what I can tell this file has to be uploaded.

If your theme is using the_custom_logo() then you can edit it by going to Appearance > Header, as described here.

I'm confused how the person before me did this. Is there a way to just add the logo to the site files and have the site update automatically?

You would need to add the logo file to the theme (or child theme) and replace the the_custom_logo() with the HTML for a logo that references that file. You can use get_theme_file_uri() to get the URL for an image in the theme.

Ideally I'd like to keep using the_custom_logo() because it does a bunch of stuff that I would rather not duplicate and have to keep up to date with upstream.

That function is designed for use with images uploaded to the media library, and isn't really usable without an image uploaded to the media library, since that's where it gets all the information from.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.