12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Oct 22, 2020

ACF Custom User Field Values in Oxygen

Sridhar Katakam

In this members-only tutorial, we shall register a custom function that returns the value of a user custom field created using the Advanced Custom Fields plugin which can then be used not only for displaying the currently logged-in user's custom field values but also for conditionally outputting any element using Oxygen's Dynamic Data condition depending on whether the field is empty or if it has a specific value etc.

Step 1

Let us first register a custom user field for users to have their Twitter handle.

Install and activate ACF or ACF Pro.

Go to Custom Fields > Add New.

Create your desired custom fields and set the field group to appear where User Form = All.

Registering an ACF user field group in WordPress

The new field will now appear when editing user profile pages and can be populated.

Populating ACF user field

Step 2

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: Return value of current logged-in user's custom field

Code:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right