UsersWP has no setting to shorten a last name to its initial, but a short snippet can save every user’s display name as “First L.” whenever their account is saved. The display name is what WordPress, UsersWP and GeoDirectory show next to reviews, comments and posts, so the change reaches all of those.
The profile URL is not affected. It is built from the user’s login name, so /profile/username/ stays the same.
The snippet
Add this to your child theme’s functions.php or a code snippets plugin:
add_filter( 'wp_pre_insert_user_data', 'my_first_name_last_initial', 10, 4 );
function my_first_name_last_initial( $data, $update, $user_id, $userdata ) {
$first = isset( $userdata['first_name'] ) ? trim( $userdata['first_name'] ) : '';
$last = isset( $userdata['last_name'] ) ? trim( $userdata['last_name'] ) : '';
if ( $first && $last ) {
$data['display_name'] = $first . ' ' . mb_substr( $last, 0, 1 ) . '.';
}
return $data;
}
It runs whenever a user is created or updated, through the UsersWP register and account forms or in wp-admin. Users who have both a first and last name get “First L.” Anyone else keeps their current display name. It overrides any display name a user types themselves, so remove the Display Name field from the account form in UsersWP > Form Builder to avoid confusion.
Existing users are updated the next time their account is saved. To update everyone at once, edit and save each user, or run wp user update with WP-CLI.
Hiding the full last name
The First Name and Last Name fields on the profile page have their own visibility. In UsersWP > Form Builder, open the field, click Show Advanced and set Is Public to No, or to Let User Decide so each user chooses. That hides the field on the profile but does not change the display name.