I am trying to display author meta data (username, email) in a custom sidebar widget and I cannot figure it out.

I can display the info on a template page (using php) just fine but that wont work for what I need. I have also figured out how to call the meta data by manually specifying the user id.

I have tried using the same code that works on the template page in my widget code but it wont work (I am not using the WP widget section).

How can I display the meta data (username and email) in the sidebar widget? Is there a way to pull the user id of a post with php? Or is there a better/different way to pull the user meta by php? I am guessing the widget doesn't have access to the same post information that the normal page does?


1 Answer 1


I figured it out, completely accidentally. I had already tried the solutions posted but they did not work for me, most likely due to the theme I am using (TravelTour).

For me, to get the user meta to display I had to call wp_reset_query before it. I have no idea why.


// then
echo get_the_author_meta('user_email');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.