Answers.Body: <p>You can use <a href="https://wordpress.org/plugins/civicrm-wp-profile-sync/" rel="nofollow noreferrer">CiviCRM Profile Sync</a> for this if you have <a href="https://wordpress.org/plugins/advanced-custom-fields/" rel="nofollow noreferrer">ACF</a> installed - or better still <a href="https://www.advancedcustomfields.com/pro/" rel="nofollow noreferrer">ACF Pro</a> for greater compatibility and more Field Types.</p>
  <p>It takes a bit of setting up, but what happens is that you sync a CiviCRM Contact Type with a WordPress Custom Post Type (or User) and then sync CiviCRM Custom Fields with ACF Custom Fields attached to the Post Type (or User). These can then be rendered in your theme using the <a href="https://www.advancedcustomfields.com/resources/#functions" rel="nofollow noreferrer">standard ACF functions</a>.</p>
  <p>More info can be found in <a href="https://github.com/christianwach/civicrm-wp-profile-sync/blob/master/docs/ACF.md" rel="nofollow noreferrer">the documentation</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-04-22T23:21:36.573Z
Answers.Text: Thanks, will look into this.
Answers.UserDisplayName: Michael Matthews
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-04-19T17:49:48.220Z
Answers.LastActivityDate: 2022-04-19T17:49:48.220Z
Answers.UserDisplayName: Christian Wach
Body: <p>CiviCRM 5.48.0, WordPress 5.9.3, PHP 7.4.29.</p>
  <p>I'm trying to create a link based on content in the user's profile (custom field for VIN, link is to do a recall search on that VIN, but the possibilities here are pretty much endless). My first idea was to just insert some PHP snippet using the Insert PHP Code snippet WordPress plugin ... but any PHP function to get CiviCRM user context has eluded me so far. Doesn't seem to be part of what wp_get_current_user() returns either.</p>
  <p>Then I had an idea to maybe just have a simple transform on the field... but that's eluded me as well.</p>
  <p>Thought I found a possible way with the wp-civicrm-ux extension but that killed the site when I tried to install it (didn't spend any time figuring out why, wasn't sure if it would even solve my problem).</p>
  <p>So, is there any way to access CiviCRM field content within WordPress to do custom manipulation of that data?</p>
  <p>Thanks.</p>
  <p>Michael</p>
  
Tags: <wordpress><custom-fields>
Title: How to access specific field content in WordPress pages?
ThreadText: # How to access specific field content in WordPress pages?
  
  (Asked by: username_0 on 2022-04-16)
  
  CiviCRM 5.48.0, WordPress 5.9.3, PHP 7.4.29.
  
  I'm trying to create a link based on content in the user's profile (custom field for VIN, link is to do a recall search on that VIN, but the possibilities here are pretty much endless). My first idea was to just insert some PHP snippet using the Insert PHP Code snippet WordPress plugin ... but any PHP function to get CiviCRM user context has eluded me so far. Doesn't seem to be part of what wp\_get\_current\_user() returns either.
  
  Then I had an idea to maybe just have a simple transform on the field... but that's eluded me as well.
  
  Thought I found a possible way with the wp-civicrm-ux extension but that killed the site when I tried to install it (didn't spend any time figuring out why, wasn't sure if it would even solve my problem).
  
  So, is there any way to access CiviCRM field content within WordPress to do custom manipulation of that data?
  
  Thanks.
  
  Michael
  
  **Tags:** wordpress, custom-fields
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-04-19. Score: 1
  
  You can use [CiviCRM Profile Sync](https://wordpress.org/plugins/civicrm-wp-profile-sync/) for this if you have [ACF](https://wordpress.org/plugins/advanced-custom-fields/) installed - or better still [ACF Pro](https://www.advancedcustomfields.com/pro/) for greater compatibility and more Field Types.
  
  It takes a bit of setting up, but what happens is that you sync a CiviCRM Contact Type with a WordPress Custom Post Type (or User) and then sync CiviCRM Custom Fields with ACF Custom Fields attached to the Post Type (or User). These can then be rendered in your theme using the [standard ACF functions](https://www.advancedcustomfields.com/resources/#functions).
  
  More info can be found in [the documentation](https://github.com/christianwach/civicrm-wp-profile-sync/blob/master/docs/ACF.md).
  
  > **Comments:**
  > **username_0**: Thanks, will look into this.  
  
  ---
  
  