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):
1 2 3 4 5 6 7
//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:
3 4 5
//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.
I also provided custom filter to process links. You can call it like this: