A quick search through the WP-API source revealed where validate_callback
is being used:
wp-api/lib/infrastructure/class-wp-rest-request.php
$valid_check = call_user_func( $arg['validate_callback'], $param, $this, $key );
In this case, $this
is an instance of WP_Rest_Request
– so there’s one. Now, for sanitize_callback
:
$this->params[ $type ][ $key ] = call_user_func( $attributes['args'][ $key ]['sanitize_callback'], $value, $this, $key );
Same file, there’s the $this
you’re looking for. So yes, both should get an instance of WP_Rest_Request
as their second argument.
Related Posts:
- Updating Post Meta with Backbone and the REST API
- WP API DELETE request from jquery ajax [closed]
- WordPress Rest API custom endpoint optional param
- Using the Rewrite API to Construct a RESTful URL
- WP REST API only returning partial list of users
- Slow REST API calls on self-hosted WordPress [closed]
- Why is my custom API endpoint not working?
- Retrieve all users from wordpress database via REST/JSON API
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- REST API endpoint for elasticpress autosuggest
- How can I get users email (and additional data) from the rest API?
- How to stop WP API endpoint from caching?
- WordPress 4.7 REST API endpoints
- How to: Rest endpoint returning empty object
- register_rest_field for custom taxonomy fields that are assosiated with custom post type
- How to force Authentication on REST API for Password protected page using custom table and fetch() without Plugin
- Custom endpoint that returns an xml
- Get post from custom REST endpoint in Gutenberg
- “rest_no_route” – Debug error
- WP REST API – Retrieve content from page
- How to send multipart form data to WordPress endpoint
- WordPress Rest API – Get all posts based on post_meta on custom endpoint
- Can I define multiple callback methods depending on the call method?
- ping_status in JSON REST API
- WordPress JSON API returns normal site page in html. How do I get it to give me JSON?
- Query the REST API for a Tag by slug
- Rest API Custom Endpoint with space character
- Continue execution after WP REST API response
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- WP-API restfull JSON and post meta?
- Exclude posts w/ specific post_meta on Rest API endpoint
- WP Rest endpoint with custom post type and ACF Fields
- Why aren’t tags and categories added in post request to WP Rest API
- Is there anyway to format my EndPoint URL in WordPress?
- Does it still make sense using json endpoint ep_mask now that there’s the new rest api? [closed]
- Querying A Post That Includes Two Taxonomies Using JSON Rest API
- Create User using JSON API
- Custom Rest API POST endpoint with conditionally required parameters
- WP Remote Request not returning all of content via request
- How to force JWT auth for default GET endpoints of WordPress rest api?
- WordPress Rest API custom endpoint for RSS feed
- Custom endpoint to get all custom taxonomy terms
- Create a new post from hybrid mobile App in WordPress using JSON API plugin
- Update post using json api v2
- Can you use a WordPress permalink to get a post with the JSON API?
- Can’t retrieve body params from PUT endpoint using formdata
- How to create WordPress custom end point with multiple parameters?
- JSON – Create rest api endpoint for Advanced Custom Fields
- Do I need to create an endpoint?
- Custom route and query
- REST Endpoint API 404
- How to add an endpoint for my custom post type? /wp-json/wp/v2/posts is working but it didn’t in the custom post
- Fetching ten ten records from JSON API in word press
- Filter out posts based on a certain post_meta on the WordPress REST API
- how to use nimble-API and Display data?
- WP_REST_Response – How to return Gzip answer and add Content-encoding header?
- Rest API Paginate until all posts are imported
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Custom endpoint filtering post by custom taxonomies
- REST public POST giving 403 forbidden nginx
- How to add field to custom post type endpoint
- What’s the right way to validate JSON data coming from an AJAX POST request?
- Get UserInfo from WordPress
- How the wordpress login and signup in react native app
- Consult array data in REST API Filter
- Update block once an API request returns with a value
- How can I secure my custom rest api endpoint or add under a already existing rest group
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- How to require files in a custom endpoint
- Extending the API I created to return category names
- .htaccess and proxy settings for routing a decoupled REST API consuming theme
- Custom Rest API namespace and endpoints are responding with 404 & 503 errors
- WP API users per page
- WP-API + JS Backbone client – how to update post meta
- multi-language multi-site with REST API
- JSON API : Add a method called create_user to create a new user
- Using WordPress.com API to retrieve featured images
- Securing REST API wp-json/wp/v2/users endpoint
- Delete row from table using custom endpoint via API
- Custom rest api endpoint response json problem
- Custom WP rest api endpoint only working on non https?
- External api call using wordpress
- What is different about using admin-ajax.php in an endpoint and just submitting a form from the front end?
- REST API Plugin Update call back not updating the plugin
- WooCommerce Order Sync via Custom REST API Endpoint Failing
- Using Nested Blocks With Custom Query Block
- Is the WordPress REST API installed and enabled in a vanilla WordPress 4.7 installation?
- WP Rest API – How to get featured image
- WordPress 4.7.1 REST API still exposing users
- How do you retrieve a post by slug name through REST API?
- Does something like is_rest() exist
- Hiding WordPress REST API v2 endpoints from public viewing
- Get WP Navigation Menu from REST API V2
- How to: Make JWT-authenticated requests to the WordPress API
- WP REST API fetch posts from post type
- How can I use WordPress functions in my stylesheet?
- How to use OAuth authentication with REST API via CURL commands?
- With Rest V2 (WP4.7) how does one restrict certain RESTFUL verbs?
- WP Rest API: details of latest post including featured media url in one request?
- WP REST API: filter by category 1 AND category 2