ID author of the best answer
I need to pull in the template file ID of the author of the best answer how to do it?
winfolk (Buyer) Answered question
Since 4.0, you can do this:
$best_answer = ap_selected_answer( 23 ); // Replace number with question id. $answer = get_post( $best_answer ); $author_id = $answer->post_author;
winfolk (Buyer) Posted new comment
If there is no better answer then the result is 1. Why?
Do a answer recount from AnsPress options -> tools.
It does not help. Are there any other ways to get a user ID with the best answer?
Please share your code
Hello Just checked this function and never returns 1 if no answer selected. Please try updating to development version. Or contact me by email with temporary credentials.
I noticed that if there is no better answer, then the ID of the author of the post is shown
Sorry I am not able to understand. You want user ID of best answer?