Snippets: 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' );

Snippet Type: PHP

Posted Under: Logo

All PHP snippets should be added via a child theme's functions.php file.