Home › Forums › General Issues › Pull in fields from page with same name as username › Reply To: Pull in fields from page with same name as username
Hi Nuro, that’s a no on that but thank you for your suggestion.
It’s crazy. It seems so easy yet just doesn’t work.
Trying it normally with manual ID of page like:
<?php $other_page = 890; ?> <?php the_field('field_name', $other_page); ?>
…works great so the data IS being passed from the other page. I then had another idea of trying this way:
<?php global $current_user; get_currentuserinfo(); $username = $current_user->user_login; $other_page = $username; ?> <p><?php the_field('favourite_movie', $other_page); ?></p>
…which didn’t work either.
The username of the current user IS also working when I ask for it conventionally:
<?php global $current_user; get_currentuserinfo(); echo 'Username is ' . $current_user->user_login . "\n"; ?>
Elliot, how can I debug this? I’ve tried dumping the values:
<?php global $current_user; get_currentuserinfo(); $other_page = $current_user->user_login; $values = get_field('favourite_movie'); var_dump($values); ?>
and get bool(false) printed out?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
❓Ever wondered when and why ACF uses JSON instead of the database? Check out our summary of the most recent session of ACF Chat Friday for the answer, and make sure to register for the next session.— Advanced Custom Fields (@wp_acf) February 23, 2023
© 2023 Advanced Custom Fields.