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.


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


#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.

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

	return $user_meta;


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

#Limit the fields that are loaded from the CRM

By default WP Fusion will load any fields from the CRM that are enabled for sync from the Contact Fields tab. This example lets you limit the loaded data to name and email address, while ignoring any other data.

function limit_loaded_metadata( $user_meta, $user_id ) {

	$limited_meta = array(
		'first_name' => $user_meta['first_name'],
		'last_name'  => $user_meta['last_name'],
		'user_email' => $user_meta['user_email'],

	return $limited_meta;


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

#Convert a role title to a role slug

This example is the inverse of the example on the wpf_user_update documentation page.

When a role “Volunteer” is loaded from the CRM, this converts it to the role slug volunteer_both, so that the role is properly set for the user.

function set_volunteer_role( $user_meta, $user_id ) {

	if ( isset( $user_meta['role'] ) && 'Volunteer' === $user_meta['role'] ) {
		$user_meta['role'] = 'volunteer_both';

	return $user_meta;


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

Was this helpful?