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

4.82K 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

Hello Frank,

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

ap_get_post()

This function will return all post metas.

You are viewing 1 out of 2 answers, click here to view all answers.