WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need help,need to pass data from page,to widget function,I need to pass author id to widget,any idea? Tnx

share|improve this question

It should be possible to read the global $post variable in your widget function. This will contain all information about the post (or page) displayed on the current page.

share|improve this answer
Ok,but in that way,if we are not on page where we dont have global $post var,how to find id of author,for example if we are on archive page,where we list all post from one category? – user1147 Oct 27 '10 at 10:37
@user1147: The author of which post do you want? On an archive page you can still rewind the loop and go over every displayed post to collect the authors. If you want one specific post, you can use get_post() to query for it. – Jan Fabry Oct 27 '10 at 11:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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