If I have a post with a spacing in it (like: Hello World), than get_the_title shows me only "Hello" as a link and not the whole permalink. I already tried using a substring to get it done, but it did not work out for me. Am I missing here something?

I just used get_the_title(); and put it in a variable.


$titletest = get_the_title();

echo " <a href=http://www.testungsss.com/search?q=$titletest>$titletest</a> ";
  • 1
    show us your code.
    – Milo
    Commented Jun 16, 2013 at 16:28
  • There is not much to show really. I updated my code. Commented Jun 16, 2013 at 16:38

1 Answer 1


Your title isn't correctly encoded for use in a query variable. Try this:

echo ' <a href="http://www.testungsss.com/search?q=' . urlencode($titletest) . '">' . $titletest . '</a>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.