get author_name from queried post

The problem with your code lies in these three lines: $queried_post = get_post($post_id); $author_id = $queried_post->post_author; $first = $user_info->user_nicename; You correctly get authors ID, but then you try to get some field of user_info variable, which is not defined anywhere in your code. One way to fix it is to get user info (using get_userdata) … Read more

wp_remote_get() returns 403 while file_get_contents() does not

Why do you have curly brackets in there? Maybe sanitize/process the query string with htmlspecialchars() first. The error is complaining about non-standard characters…which is what your curly brackets are doing. Build the query string with the $ip value, convert with htmlspecialchars(), then add the URL to the query string. Pass that variable to the wp_remote_get() … Read more