Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

saltandpepper on "get_user_by slug isn't working"

$
0
0

This is the code I have and get_user_by seems to be returning an empty object

global $this_player;
$player_name = strtolower(str_replace(" ","",trim(str_replace(range(0,9),'',get_the_title($id)))));
$this_player = get_user_by('slug', $player_name);
if ( !$this_player ) die('No valid user found!');

Now I can't past the if statement, however if I manually replace $player_name with 'nicename' then it works, I have confirmed that $player_name is holding nicename so I am a little confused.

Thanks


Viewing all articles
Browse latest Browse all 8245

Trending Articles