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";
?>
Baffled.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.