Skip to content

Instantly share code, notes, and snippets.

@kimwhite
Forked from dparker1005/prevent_oembed.php
Last active May 20, 2022 20:35
Show Gist options
  • Save kimwhite/327952a10aad6180056fcd92055a2ede to your computer and use it in GitHub Desktop.
Save kimwhite/327952a10aad6180056fcd92055a2ede to your computer and use it in GitHub Desktop.
Prevent oembeds from running on a particular page. KEEP Label as url link
<?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'] , '/directory/') !== false ) {
$result = ('<a href="'. $url . '" target="_blank">Website</a>' );
}
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