I'm running into an issue where i'm trying to get the Post ID while trying to hook into a plugin function(function is inside my functions.php file)
For some reason global $post
is not working!
My objective is to store the current posts, post ID into a variable where after the quiz is done, it will update a custom field.
Here is my code below. I'm echoing the $post->ID; just to test, but I'm not getting anything back.
add_action('ssquiz_finished', 'after_quiz_done', 10, 4);
function after_quiz_done( $quiz_id, $user_id, $questions_right, $total_questions )
{
global $post;
echo $post->ID;
}
Any help would be greatly appreciated.