wordpress - How to show front end ACF field from user profile? -


i'm trying echo acf value on frontend woocommerce account page. value stored against user account. problem i'm having getting value current logged in user.

i've got following code should work according http://www.advancedcustomfields.com/resources/how-to-get-values-from-a-user/ should work.

<?php $user_id = get_current_user_id();  $number = "user_$user_id"; the_field('domain_name', $number); ?> 

but doesn't! remove the

$number = "user_$user_id"; 

and replace

$number = "user_3"; 

it works perfectly....but hardcoded value, rather calling current user id

any appreciated.

you should forming $number this:

$number = "user_".$user_id; 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -