2

I'm somehow new to Wordpress and its API and while writing an simple Rest Service to an remote Server i have been asked to use the native wp_remote_X functions. Right now i have some trouble to distinguish between them both:

wp_remote_post() 

wp_remote_request().

Does it make any difference which one to use or is the wp_remote_request an alias to missing wp_remote_delete() and wp_remote_update() ?

2

1 Answer 1

4

You should be able to use both wp_remote_request() and wp_remote_post() for a 'POST' request, as they are just wrappers for the same WP_Http::request method that supports the methods:

'GET', 'POST', 'HEAD', 'PUT', 
'DELETE', 'TRACE', 'OPTIONS', 'PATCH'.

and the default one is 'GET'.

The difference is that wp_remote_post() function has the 'POST' method explicitly set via WP_Http::post that's also a wrapper for WP_Http::request.

Your Answer

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

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