Skip to content

Instantly share code, notes, and snippets.

@titodevera
Created June 23, 2021 15:12
Show Gist options
  • Save titodevera/714dd5d79a9531f95180a744f5359bb3 to your computer and use it in GitHub Desktop.
Save titodevera/714dd5d79a9531f95180a744f5359bb3 to your computer and use it in GitHub Desktop.
Perfect Brands for WooCommerce: Allow external URLs in brands banners
<?php
add_filter( 'site_url', function( $url ) {
if ( ! is_tax( 'pwb-brand' ) ) return $url;
preg_match( '/http(s)?:\/\/.*(?=http(s)?)/', $url, $matches );
if ( ! empty( $matches[0] ) ) $url = str_replace( $matches[0], '', $url );
return $url;
}, 90 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment