Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
820 views
in Plugins by
edited by
My website setting is neat_url where the links are search engine friendly like http://myDOmain.com/3424/the+title+of+question

 

however I need to edit a plugin for which i need to remove the title from the url. How can i do that? I am askiing this becasue qa_path_absolute( qa_request() ) returns neat url but I dont want the title part from the neat url

Thank you
Q2A version: 1.72

1 Answer

+1 vote
by
edited by

One simple option would be to use a regex to strip the end part. Something like

$url = preg_replace('#/([0-9]+)/[^/]+#', '/\1', $url);

Another way would be to just create the URL with the question ID. If you're on the question page it should be somewhere in the $qa_content variable.

by
My mistake, I missed that it actually is in Q2A. Complete brain fade there...
by
that still works
I just wanna remove title from url to shorten the url  for sharing
...