How to Prevent BuddyPress From Changing Comment Author URLs

bp-comments-filter

Did you know that BuddyPress changes the URL for comment authors to point to the user’s BuddyPress profile? It does this by filtering the ‘comments_array’ in the bp-core-filters.php file to insert BuddyPress URLs for blog post comments:

add_filter( 'comments_array', 'bp_core_filter_comments', 10, 2 );

For most BuddyPress sites this is a good thing, since it emphasizes users’ profiles and interaction on the site, helping members connect to each other on the social network. However, there are some WordPress sites that take a different approach to comments. People don’t always leave comments purely to join a conversation. Unfortunately, many users are motivated, at least partially, by having a link back to their own sites.

If you want to stop BuddyPress from changing the comment author URL to the profile link, it’s as simple as removing the filter:

remove_filter( 'comments_array', 'bp_core_filter_comments', 10, 2 );

Add that to your bp-custom.php file or create your own little functionality plugin for it.

As noted by @modemlooper in the comments, if you go the custom plugin route, you’ll need to make sure that BuddyPress is active before removing the filter:

function remove_url() {
remove_filter( 'comments_array', 'bp_core_filter_comments', 10, 2 );
}
add_action('bp_include', 'remove_url');

Once activated you should see that the comments now pull the url from the admin area profile.php page or the URL the user has entered in the comment form.

4

4 responses to “How to Prevent BuddyPress From Changing Comment Author URLs”

  1. If you go the route of creating a plugin make sure BP is loaded or the remove will fire before BP as loaded the filter.

    function remove_url() {
    remove_filter( ‘comments_array’, ‘bp_core_filter_comments’, 10, 2 );
    }
    add_action(‘bp_include’, ‘remove_url’);

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.