• How would I go about getting the post title for any post, but having all the whitespaces replaced by the % sign?

    The reason I need to do this is because on my website I have a submit to delicious button, and it allows me to put in the title as a variable, but it does not allow whitespaces in the URL of course.

Viewing 1 replies (of 1 total)
  • This should work:

    $postid = 237;
    $newtitle = preg_replace('/ /','%',get_the_title($postid));

    But, you may need to replace with %20, not just %.

Viewing 1 replies (of 1 total)
  • The topic ‘Get Post Title but Replace Whitespaces with %’ is closed to new replies.