You can use $request->get_json_params()
which will return an array of key => values.
With these conditions(possibly a few more):
- The client sending the request has
Content-Type: application/json
in the header - There is a raw body like
{"option":"siteColor","value":"ff0000"}
.
https://developer.wordpress.org/reference/classes/wp_rest_request/get_json_params/
Related Posts:
- wp rest api v2 return json_no_route
- WP-REST API not returning all its endpoints, 404 on documented endpoints
- WP REST API V2 – Modifying responses
- OAuth signature does not match
- How to upload image to wordpress from external page
- WP API to fetch all records for /posts, /media, /categories
- WP Rest API get page from path
- backbone fetch() not working
- WP-API user email change confirmation
- No featured media in API request
- Syntax for REST API to have bold formatted and multiple lines in product description [closed]
- WP Rest get all by post within that category, by category name not by cat ID
- Add Data to Response of WP-JSON Root
- OAuth1 empty “authentication” in /wp-json
- WP – API – OAuth 1.0a Server, How to implement with AngularJS?
- Are there events pub/sub for external application to subscribe to file/pdf uploads by wordpress admin
- WP API and Proxy
- Get single item from cURL plugin API call inside bash [closed]
- why woocommerce api only do not upload images from local computer? [closed]
- ng-repeat is not returning a list of posts
- What request is WordPress sending on theme update?
- Is WP API going to be around in the long term?
- How to Create a Post from localfiles?
- Get a complete list of all categories using node-wpapi
- upload image to wp-api
- WP-API call function
- wordpress api make 2 custom post type with single request
- Update Custom Post Type Metadata Wp Rest API
- WP-API Content showing null
- How to retreive/set wordpress page html?
- How can I use React packages with the clasic editor?
- Query WP REST API v2 by multiple meta keys
- Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- Are there server performance benefits to fetching only specific fields when querying the REST API?
- WordPress Rest API
- Insert variations via woocommerce api [closed]
- Fetching private posts or custom post types via WP-API with basic authentication
- Custom endpoint and X-WP-TotalPages (headers)
- WP Rest API v2 filter and display latest post with specific tag
- How do I use the WP REST API plugin and the OAuth Server plugin to allow for registration and login?
- Can I list all installed plugins/versions and wp version from API
- How do I retrieve a list of popular plugins using the WordPress.org Plugin API?
- Hiding API routes list
- Get more than 10 posts in a specific category with the wordpress api
- Add Products to Woocommerce through WP API
- WP REST API – Retrieve content from page
- Updata Metadata WP Rest API
- Keep getting 401 error from WordPress on AWS Lightsail
- node-wpapi: how to handle authentication?
- Backbone.js and WP API
- React post to WordPress custom post type
- Post body not working with wp_remote_post()
- Hook before posting via JSON REST API
- Display post title from WordPress excluding a string via API
- WP_REMOTE_POST Requests are being blocked by API provider [closed]
- Cache WP remote_get HTTP Response using Transients
- I am getting error message on accessing menu-endpoint
- Update Line Item Meta Data – WooCommerce API
- Use the backbone.js client to save custom post type meta
- Get non-rendered content from WP-API
- No ‘Access-Control-Allow-Origin’ when call rest API
- Woocommerce api: create product with images – bad request
- Adding custom end points, No error line
- Using WP-API and SSE not authenticating user ID
- Custom Post Type not showing in Rest API on Multisite
- Posting page on all subdomains
- WP-API select custom taxonomy when creating a post
- Authenticating a user with the WP-API V2 in Postman
- Faceted search with WP-API data
- Get a remote post ID via API given URL
- WordPress API for custom post types returns rest_no_route
- WP REST API – get custom taxonomies based on terms & filter
- Getting featured image with PHP and not javascript from wordpress api _embed [closed]
- How to change the date and time in REST API for comments?
- Is there a way to download only the Rest API part of WordPress?
- Custom Endpoint API based on attribute gutenberg block
- How can I spin up a new website for a registered user automatically?
- Custom REST endpoint not working to retrieve single posts (“rest_no_route”)
- Why is wp api returning old acf values?
- Why are tags from the header showing up on my WordPress site? [closed]
- WP-API: get posts in multiple categories
- WP-API Custom Post Type json_no_route
- Cannot use WordPress Application Passwords: “code”: “rest_no_route” “status”:404 for /wp-json/wp/v2/users/me/application-passwords
- wp-api Backbone JS Client fetch options
- is_user_logged_in not working from WP-API (wp-json)
- wp_update_user very slow
- How to use following API with WordPress?
- Help to create the best plugin settings!
- How to use the WordPress API to get links and scripts in and
- Woocommerce REST API not considering discounts and coupons
- WooCommerce API Returns 401
- WordPress Customazation API section in section
- Combining results from WP-API using AngularJS
- return content section as json in wp rest api v1
- WP-API : post_meta not updated… but have another entry
- get_post_thumbnail_id() not getting correct featured image after post edited
- XMLRPC: How to retrieve possible custom fields for a new post?
- How can I create a custom plugin to call webapi after user registration?
- How to submit a button automatically after every scheduled hours?
- How can I enforce user to use Application password to generate JWT token? [closed]