Support

Account

Home Forums ACF PRO Getting Field Value in functions.php

Solving

Getting Field Value in functions.php

    • rdueck

    • February 10, 2017 at 11:20 am

    I created a custom field for the user form and am looking to display it on the users profile page on the front end using a hook. However, after a lot of trial and error, I can’t seem to get the field value to display. Here’s what I have so far. it’s a simple text field I’m looking to display.

    add_action( 'wc_memberships_before_my_memberships', 'customerid' );
        function customerid() {
            echo "<p>Customer ID: "; echo get_field('userid'); echo "</p>";
        }
  • Does this wc hook wc_memberships_before_my_memberships pass any values to your action, like the user’s ID?

    In order to get a field from a user you need to provide the correct ID. The correct ID is "user_{$user_id)" see the Get a value from different objects section of https://www.advancedcustomfields.com/resources/get_field/

    • arcos

    • January 11, 2019 at 7:36 am

    were you able to figured this out?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.