Masking links in custom fields with wp-noexternallinks

Warning! I no longer support this plugin after version 3.5.9.9! Please ask questions on wordpress support page.

Masking links in custom fields with wp-noexternallinks is really simple. At first, you need to find the place where your custom field is being output. It should be in your theme file, single.php.

Then edit output so it looks like this (you should change custom_field_name to your field name):

//get custom field text with links:
$text=get_post_meta(get_the_ID(), 'custom_field_name', 1);
//Apply all the filters that are used for post content on custom field text.
//It will also apply wp-noexternallinks filter:
$text_filtered=apply_filters('the_content',$text);
//output filtered text:
echo $text_filtered;

Notice that if you don’t mask links in your posts’s content but mask them in comments, your fifth line should look like this:

//Apply all the filters that are used for user comments on custom field text.
//It will also apply wp-noexternallinks filter:
$text_filtered=apply_filters('comment_text',$text);

If custom field output is generated by plugin then unfortunately you will have to edit plugin code or try to preprocess it’s output.

UPDATE I also provided custom filter to process links. You can call it like this:

$text_filtered=apply_filters('wp_noexternallinks',$text);