Support

Account

Home Forums General Issues [Help Please ] Can't get fields or their values

Solving

[Help Please ] Can't get fields or their values

  • I just installed ACF Pro for the first time. I created a test field in a test group assigned to a user. I can see the field on the user page with a defined value.

    I tried all the functions listed on the docs to retrieve the field or its value in my code but Im failing.

    I tried:

    get_field( “test_field”, “user_1” );
    get_field( “test_field” );

    and the object functions as well.. I dont even see the custom field in the user meta.. what am I missing?

  • Is the user you’ve saved data for user 1?

    This code:

    get_field( 'test_field', 'user_1' );

    Gets the data for user ID 1. If you wanted user ID 9 you’d need to do:

    get_field( 'test_field', 'user_9' );

    For example.

    If you’re not seeing the data even in the wp_usermeta table something else may be going on as well.

  • Can you please provide the code you are using to output the values? or is what you posted exactly what you added to your template to show the value?

    
    get_field( “test_field”, “user_1” );
    

    Try

    
    echo get_field('test_field', 'user_1');
    

    or

    
    the_field('test_field', 'user_1');
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.