0

Is it possible to create a Wordpress page or post with a curl command from Linux console?

I tried using the available REST API, but for some reason can't figure it out. If you could give me an example I will be very happy.

Thanks

  • 1
    Can you add the code that you tried with REST? – Aravona Jul 3 '18 at 15:50
  • Also what kind of authentication did you use? – Tom J Nowell Jul 3 '18 at 16:29
  • Is the WP-CLI an option? – kero Jul 4 '18 at 8:14
  • Hello and thanks for the comments. No, wp-cli is not an option for now. I tried this so far curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"title":"Title","content":"Content","type":"page"}' http://site-domain.com/wp-json.php/posts -u user:pwd – Radoslav Stefanov Jul 4 '18 at 8:27
  • I figured it out. What I had to do is to enable pretty permalinks (because my Wordpress Docker container didnt have it enabled) and rest API started working. – Radoslav Stefanov Jul 4 '18 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.