Skip to content

Snippet: Remove http/https Protocol From Logo Image SRC

function myprefix_remove_http_from_logo_url( $url ) {
	if ( $url ) {
		$disallowed = array( 'http:', 'https:' );
		foreach( $disallowed as $d ) {
			if ( strpos( $url, $d ) === 0 ) {
				return str_replace( $d, '', $url );
			}
		}
	}
}
add_filter( 'wpex_header_logo_img_url', 'myprefix_remove_http_from_logo_url' );
add_filter( 'wpex_header_logo_retina_img_url', 'myprefix_remove_http_from_logo_url' );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top