$url = "".$_POST["nonace"].
//echo $url; exit;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, false);
echo "<pre>";
    echo "status ------------------------------ ".$ar->status."<br>";
    echo "Link ------------------------------ ".$ar->post->url."<br>";

this my code to create a post everthing is fine but when i create a post with spaces in my title or content it only considering first word and leaving reamining

Examples:content without spaces

in my return json object iam getting it like

"status": "draft",
    "title": "sivaji",
    "title_plain": "sivaji",
    "content": "<p>ThisIsVeryGood<\/p>\n",

Examples:content with spaces

in my return json object iam getting it like

"status": "draft",
    "title": "sivaji",
    "title_plain": "sivaji",
    "content": "<p>This<\/p>\n"

Iam usig ajax call and text boxes to post the content

1 Answer 1


You should be urlencodeing your content. Whitespace is not a valid character in URLs. If you have access to WordPress functions on the sending side you can use esc_url. I suspect that has a lot to do with your problem.

Be aware that there is a character limit on $_GET strings. If you are going to be posting long content you should be sending over $_POST.

Your Answer

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

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