Skip to content

Instantly share code, notes, and snippets.

@dparker1005
Created August 18, 2020 19:11
Show Gist options
  • Save dparker1005/4375d48479df7590e292aff4075a0e13 to your computer and use it in GitHub Desktop.
Save dparker1005/4375d48479df7590e292aff4075a0e13 to your computer and use it in GitHub Desktop.
Prevent oembeds from running on a particular page.
<?php
// Copy from below here...
/*
* Prevent oembeds from running on a particular page.
* Can clear oembed cache with steps here: https://siteorigin.com/clearing-oembed-cache/
*/
function my_pmpro_prevent_oembed($result, $url, $args) {
if ( strpos( $_SERVER['REQUEST_URI'] , '/member-directory/') !== false ) {
$clickable = make_clickable($url);
$result = str_ireplace( '<a href=', '<a target="_blank" href=', $clickable );
}
return $result;
}
add_filter('pre_oembed_result', 'my_pmpro_prevent_oembed', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment