SHARE
TWEET

Untitled

elhardoum Feb 9th, 2017 125 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('the_content', function($c){
  2.     return preg_replace_callback("#<\s*?a\b[^>]*>(.*?)</a\b[^>]*>#s", function($m){
  3.         $tpl = $m[0];
  4.         $cnt = isset($m[1]) ? $m[1] : null;
  5.  
  6.         if ( preg_match('/<a(.*?)?href=[\'"]?.+\.(png|jpg|gif|jpeg|bmp)[\'"]?(.*?)?><\/a>/i', str_replace($cnt, '', $tpl)) ) {
  7.             return $cnt;
  8.         } else {
  9.             return $tpl;
  10.         }
  11.     }, $c);
  12. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top