wpf_get_contact_id()

#Overview

This function retrieves a user’s CRM contact ID based on their WordPress user ID.

#Parameters

wpf_get_contact_id( $user_id = false, $force_update = false )
  • $user_id (int) (Optional): The user ID to the contact of.
  • $force_update (bool) (Optional): If the contact ID should be automatically saved.

#Return

(mixed) Returns a string of the contact ID, or false if nothing is found.

#Get the current user’s contact ID

$contact_id = wpf_get_contact_id();

#Get the contact ID for a different user

$contact_id = wpf_get_contact_id( $user_id );

#Force an update of the user’s contact ID by sending an API call to your CRM

In this case the updated contact ID will automatically be saved to the local user meta after it’s been retrieved.

$contact_id = wpf_get_contact_id( $user_id, true );

Was this helpful?

Our Black Friday Sale is Here! 🎉

Take advantage of the biggest discount we’ve ever offered. Save 30% off new licenses and upgrades.

Days
Hours
Minutes
Seconds
Sorry, this offer has expired.

Valid until Tuesday December 2nd.
See Terms and Conditions