add_filter( 'the_content', 'text' );
function text( $content ) {
$content = preg_replace('~<a\s[^>]*href=[\'"]?https?://[^\s\'">]+\K/(?=[?\s\'">])~i', '', $content);
return $content;
}
add_filter( 'the_content', 'text' );
text( $content ) {
$content = preg_replace('~(<a\b[^>]/>)', '~(<a\b[^>]>)', $content);
return $content;
}