I have a doubt, I want to change the header logo in different URLs in wordpress, for example, a logo in CONTACT, another in ABOUT, another in SERVICES and I have built this code but it does not work very well, in fact it does not work, it does not change the picture. This is the URL I am validating in the code below: https://mypage.com/daewoo
function change_logo_on_single($html) {
if(is_page('daewoo')){
$html = preg_replace('/<img(.*?)\/>/', '<img src="https://mipagina.com/wp-content/uploads/2019/11/serv_03.png" class="custom-logo" alt="" itemprop="logo" />', $html);
}
return $html;
}
add_filter('get_custom_logo','change_logo_on_single');
You can try with this:
It may not be the most elaborate answer, but it works for what I had to do.
It's hard? NO
You really have to search for the ID of the web and the ID of the image, how?
Right click, INSPECT
and the image id looks like this:
Below I leave the code that changes the logo depending on the page.