add_filter('wpforo_content_after', function( $content ){ return preg_replace_callback( '#<]*\sclass=[\'\"](?:[^\'\"]*\s)?wpforo-default-attachment(?:\s[^\'\"]*)?[\'\"][^><]*\shref=[\'\"]([^\"\']+)[\'\"][^><]*>.*?#isu', function( $match ){ $html = $match[0]; $file = $match[1]; $pathinfo = pathinfo( $file ); if( wpforo_is_image($pathinfo['extension']) ) { $html = sprintf( '%2$s', esc_url($file), esc_attr($pathinfo['basename']) ); } return $html; }, $content ); }, 11);