[wp-trac] [WordPress Trac] #40697: Can't create new post by REST API but I can update existing post
WordPress Trac
noreply at wordpress.org
Wed May 10 14:13:18 UTC 2017
#40697: Can't create new post by REST API but I can update existing post
--------------------------+----------------------
Reporter: Alaa Rihan | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: REST API | Version: 4.7.4
Severity: normal | Resolution: invalid
Keywords: | Focuses:
--------------------------+----------------------
Changes (by JPry):
* status: reopened => closed
* resolution: => invalid
Comment:
As @rmccue mentioned, the URL you're hitting is wrong. You're defining
`apiURL` as already containing "wp/v2", yet you're trying to append it
again in your script. Written as-is, the URL for the Ajax request will be
something like `http://eample.com/wp/v2wp/v2/posts`. This is why you're
getting the 404 error. The correct URL would be
`http://example.com/wp/v2/posts`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40697#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list