Filter: postie_bare_link

This filter is called for each bare link Postie finds in your message. Bare links are plain URLs without any markup. I.e. “http://www.example.com” is a bare link. “Not a bare link” is not a bare link. Note some email clients will transform bare links into non-bare links especially if you are using rich text/html. Generally if you want to take advantage of this filter consistently you will want to set Preferred Text Type to Plain.

Parameters:

  • $html – the html that will be inserted into the post.
  • $URL – the original URL (bare link).
  • $oembed – whether WordPress thinks this bare link can be handled by the “Easy Embed” feature. See https://codex.wordpress.org/Embeds

You must return a string that will be placed at the spot where the bare URL was found.

Example

add_filter('postie_bare_link', 'my_postie_bare_link', 10, 3);

function my_postie_bare_link($html, $url, $oembed) {
    if ($oembed)
        return htmlspecialchars($url);
    else
        return "<div class='mylinkclass'>$html</div>";
}