When you hide the logo in the Divi, you may notice that a request for the logo image is still made by the page. This is because the logo image is hidden, but is still referenced by the HTML source of the page. So the browser loads the image in anticipation of the logo being displayed (which it actually won't). Here's how to address that.
Change the logo element's src using PHP
While it's possible to fully remove the logo image tag from the page, this may affect code which expects it to be there. One way to avoid this is to change just the URL of the logo, to something that doesn't trigger a request by the browser. (Note that it's invalid HTML to have no src attribute on an image tag, so we need to supply something valid for the src, but that doesn't trigger a request).
You can use the following PHP code to do so:
add_filter('et_get_option_et_divi_divi_logo', 'db_empty_logo_src');
if (!function_exists('db_empty_logo_src')) {
function db_empty_logo_src($url) {
if (is_admin()) return $url;
return 'data:,';
}
}
Related Post: Adding PHP to the Divi Theme
0 Comments