Add Data to Response of WP-JSON Root
function filterResponse($response){ $data = $response->data; $data[‘extra_field’] = ‘some data’; $response->set_data($data); return $response; } add_filter(‘rest_index’, ‘filterResponse’); Thanks to Jeff
function filterResponse($response){ $data = $response->data; $data[‘extra_field’] = ‘some data’; $response->set_data($data); return $response; } add_filter(‘rest_index’, ‘filterResponse’); Thanks to Jeff
WP Rest get all by post within that category, by category name not by cat ID
Through more experimentation, I found the culprit- This does not work: curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded); This does work: curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); So it was the processing of the data in $data through curl which was causing the permission problem.
Posting page on all subdomains
Custom Post Type not showing in Rest API on Multisite
You don’t set featured image for your post ,so return 0 in feature image obj. after set it you can use featured image obj. for example: I wrote this with PHP, you can upload this to another host and display the images of the WordPress website that you specified in the URL variable on those … Read more
Update a post based on results from GET request to another server
Using WP-API and SSE not authenticating user ID
function custom_phrase($request_data) $request_data was missing. Fixed it 🙂
Woocommerce api: create product with images – bad request