Created
September 12, 2014 09:26
-
-
Save tribulant/56ead454c9dc1a8997eb to your computer and use it in GitHub Desktop.
Newsletters: Filter - newsletters_emailbody_links Example
This file contains 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 | |
function emailbody_links($body = null, $history_id = null, $matches = null) { | |
global $Html; | |
if (!empty($matches)) { | |
foreach ($matches[1] as $key => $value) { | |
$pattern = '/[\'"](' . preg_quote($value, '/') . ')[\'"]/si'; | |
$newlink = $Html -> retainquery('param1=value1', $value); | |
$body = preg_replace($pattern, '"' . $newlink . '"', $body); | |
} | |
} | |
return $body; | |
} | |
add_filter('newsletters_emailbody_links', 'emailbody_links', 10, 3); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment