wpf_pulled_user_meta

Overview

This filter allows you to modify a user’s meta data whenever it has been pulled from your CRM, and before it is saved to the database. To use the code examples below, add them to your active theme’s functions.php file.

Parameters

  • $user_meta: Array of user meta data, in the format array('meta_field' => 'value').
  • $user_id: ID of the user being updated

Examples

Update a user’s Display Name based on their first and last name

If you’re using the Display Name field on your site to show post authors, create member directories, or elsewhere in your templates, you may want to automatically update a user’s display name if their name is changed in your CRM.

add_filter('wpf_pulled_user_meta', 'set_display_name', 10, 2);

function set_display_name($user_meta, $user_id) {
	
	$user_meta['display_name'] = $user_meta['first_name'] . ' ' . $user_meta['last_name'];

	return $user_meta;


}