Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Load ad-busters from the theme if the REQUEST_URI matches one of the whitelisted requests.
add_action( 'init', 'x_maybe_load_ad_busters' );
function x_maybe_load_ad_busters() {
$ad_busters = array(
$request = $_SERVER['REQUEST_URI'];
$request_path = parse_url( $request, PHP_URL_PATH );
$index = array_search( $request_path, $ad_busters );
if ( false === $index )
$output = '';
$file = locate_template( array( 'static/iframe-busters' . $ad_busters[ $index ] ) );
if ( $file )
$output = file_get_contents( $file );
echo $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.