Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Get post ID from an URL?

0 votes
asked Mar 1, 2017 in Q2A Core by Bùi Lê Chí Bảo
How can I get a post ID from an given URL?

http://www.question2answer.org/qa/12345/ => ID: 123456

http://www.question2answer.org/qa/12345/?show=56483#a56483 => ID: 56483
commented Mar 1, 2017 by pupi1985
It depends on the context you are. You shouldn't be needing to parse any URL... ever.

0. Do you need that information at a server or client side?
1. Are you in a plugin module, override or a layer?
2. If in a module, which type?
3. In what part/method/function do you need that ID?
4. If you are not in a plugin context, then exactly what line of the core are you editing? (link to the github repo)

Please log in or register to answer this question.