-
-
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
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'] , '/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