Get Question, Answers and Comments Id from Permalink

8.79K viewsWordPress
1

I wanted to know if, there is any way to (reverse) get Question Id and Ids of its associated Answers and comments.

For e.g., Permalink of one of the questions is –

http://medicoshive.com/discussion/question/most-abundant-element-in-nature-is/

How to retrieve Question/Answers/Comments Ids from this link

I learnt about url_to_postid( $url ) function. But I hope to find a way to get more info (Because my main stress is to get Answers Id).

Why I want this – Because I need to display all available answers to a particular question on some other page (which is basically on completion of a quiz question), so if there is any other way to do this, that could be helpful.

Thanks.

0

See here for a WP native solution 🙂

http://www.thecrowned.org/wordpress-function-url_to_postid-not-working-with-anspress

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