Created
August 18, 2020 19:11
-
-
Save dparker1005/4375d48479df7590e292aff4075a0e13 to your computer and use it in GitHub Desktop.
Prevent oembeds from running on a particular page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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