Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by
I run a q2a based education website. I integrated it with wordpress by installing it as per the directions at https://docs.question2answer.org/install/wordpress/

Im trying to add social share function and all the plugins call the page url by $page_url.

If the page url is 'https://level-up-kids/qa/index.php/31/title" $page_url returns "https://level-up-kids/qa/31/tite" and omits the index.php which doesnt seem to link back to the correct url.

Is there a better function I should be calling to get the page url or can I add in the 'index.php' back in to the result when calling $page_url in php?

Thanks for any help

2 Answers

0 votes
Actually, I just used preg_replace to add in the index.php and that seems to be working
+2 votes

In order to link to a question you need the question ID and, ideally, its title. You just need to call the qa_q_path() function in this way:

$url = qa_q_path($questionId, $title);

This will take care of all the URL format issues you are struggling with.