REST API can’t get the response manually

I was using wrong method wp_remote_post() will work. Here is the fix code: $args = array( ‘method’ => ‘POST’, ‘timeout’ => 45, ‘redirection’ => 5, ‘httpversion’ => ‘1.0’, ‘body’ => array( ‘store_name’ => $stidStore_name, ‘customer_name’ =>$stidCustomer_name, ‘payment_type’=> $stidPaymen_type, ‘amount’=> $stidAmount, ‘customer_address’=> $stidCustomer_country, ), ); $request = wp_remote_post( $stidUrl, $args); $response = wp_remote_retrieve_body( $request ); $response … Read more

How to include file attachment in ajax submission via the rest_api?

You can really use FormData just like you could use it with the old admin-ajax.php route, but: Set processData and contentType to false. Set the method to POST and make sure your REST API route supports the POST method. $(‘#create-book-form’).submit(function (e) { // var $this = $(this); // what’s this? e.preventDefault(); var data = new … Read more

How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?

ACF has the ability to create a ‘Theme Options’ page which you can then use to conveniently centralise options for things like headers and footer etc.. ACF Options Page information As Jacob Peattie rightly points out, how you integrate this into Gatsby is outside of the scope of WPSE and may require custom development. However, … Read more

Sending posts from Python to WordPress

Use the REST API at /wp-json, there are endpoints for retrieving posts that you can POST to. You will need a plugin installed to provide authentication, I recommend OAuth2. Then, you can use an OAuth2 and a REST API library in python. You do not need to use a WordPress specific library.