Skip to main content

Disabling users link to be clickable

REQUIREMENTS

To be able to implement this guide, you need to learn how to insert PHP snippets to your website.

You can find guide here: WP Beginner

Sometimes you need to remove user links and show only user nicknames.

You can do it with following item by removing user profile url from the rest api response:

<?php
/**
* Replacing user profile URL
*/
add_filter('better_messages_rest_user_item', 'custom_disable_user_url', 100, 3 );

function custom_disable_user_url( $item, $user_id, $include_personal ){
$item['url'] = false;
return $item;
}

You can find more detailed information on this hook here