pull_user_meta()

Overview

This function triggers WP Fusion to load data from your CRM back to the WordPress user record. Any fields enabled for sync on the Contact Fields tab will be loaded.

Parameters

  • $user_id: the WordPress user ID to load the metadata for

Returns

  • $user_meta: array of key / value pairs of WordPress meta

Examples

Load a number and increment it

This example loads a custom field from the CRM, adds 1 to it if it’s numeric, and syncs the field value back to the CRM.

$user_meta = wp_fusion()->user->pull_user_meta( $user_id );

if ( ! empty( $user_meta['number_field'] ) && is_numeric( $user_meta['number_field'] ) ) {

	$user_meta['number_field']++;

	wp_fusion()->user->push_user_meta( $user_id, array( 'number_field' => $user_meta['number_field'] ) );

}

Was this helpful?