How do you get question object and all the meta data associated with it to send to Google Analytics

4.83K viewsWordPress
0

I’m trying to do something similar to this which works on posts but since the “post” itself is just the [anspress] I need to get to the question “custom post type” to

$this_post = get_queried_object();
$this_post = get_queried_object();
$author_id = $this_post->post_author;
$name = get_the_author_meta(‘display_name’, $author_id);

So the question custom post type post id I know you can do something like this – get_question_id()

but is there a way to get to all other details as well as :
1.  answer count for that question.
2.  if an answer was selected.
3.  if the question is closed
etc. etc.  whatever is available in the question object.  (is there a way to print that out?)

0

How do I effectively use that ap_get_post() or another function to get the data from all the question meta?  How do I get the question_id and pass it into it?

commented on answer

Hello Frank, will you share HTML markup (gist link)? I will add PHP in your markup.

0

Hello Frank,

Not sure if I completely understood your question but did you tried:

ap_get_post()

This function will return all post metas.