0

I'm following the official documentation to requesting the REST API endpoint to delete media.

I already have Basic Auth plugin installed in my WP and I'm able to upload media by REST API, but when I try to delete it, I'm getting error 401, "You don't have permission to delete this post".

What should I do to fix this issue?

  • Why not use the standard cookie authentication? And what's your code? – Sally CJ Jul 17 at 12:29
  • I have a bunch of images to import and remove (more than 1000), so I created a PHP script to do this. So I'm not in Wordpress website context – Lai32290 Jul 17 at 13:42
  • Have you tried using the JWT plugin? And is the HTTP Authorization header enabled on your site? – Sally CJ Jul 18 at 0:09
  • I'll try the JWT plugin so, I'm not sure about Authorization header, but I'm able to upload by REST api, so I think the header is fine. – Lai32290 Jul 18 at 0:11
  • 1
    Ok, I suggest you to try the JWT plugin first. You can also check this answer and if you got stuck, you can update this question. – Sally CJ Jul 18 at 0:19

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.