WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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> ";
share|improve this question
show us your code. – Milo Jun 16 '13 at 16:28
There is not much to show really. I updated my code. – user1627363 Jun 16 '13 at 16:38
up vote 3 down vote accepted

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>';
share|improve this answer
Thanks, it works! – user1627363 Jun 27 '13 at 13:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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