Check if your code looks like this because in the question you pass each method as separate function arguments (I have overlooked it earlier)
add_action( 'rest_api_init', function () {
register_rest_route('my-project/v1/', '/form',
array(
array('methods' => 'GET',
'callback' => 'GET_form',
),
array('methods' => 'POST',
'callback' => 'post_form'
)
)
);
});
As you can read in documentation:
Parameters #
$args – (array) (Optional)
Either an array of options for the endpoint, or an array of arrays for multiple methods.
Default value: array()
Related Posts:
- Why is my custom API endpoint not working?
- WordPress 4.7 REST API endpoints
- Query the REST API for a Tag by slug
- Rest API Custom Endpoint with space character
- Is there anyway to format my EndPoint URL in WordPress?
- Custom Rest API POST endpoint with conditionally required parameters
- 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
- What’s the right way to validate JSON data coming from an AJAX POST request?
- How can I secure my custom rest api endpoint or add under a already existing rest group
- 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
- Is the WordPress REST API installed and enabled in a vanilla WordPress 4.7 installation?
- WordPress Rest API custom endpoint optional param
- check the requesting url
- WP REST API Require Password for GET Endpoint
- WP REST API V2 – Retrieve sub page by full slug (URL/Path)
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- WP REST API core major changes
- How to use the WP REST API for new user registration (sign up form)?
- Can I authenticate with both WooCommerce consumer key and JWT?
- WP REST API: check if user is logged in
- Adding post fields in wp-json/wp/v2/search
- Unable to get the info of the user which doesn’t have created any post via REST API
- WordPress REST API “rest_authentication_errors” doesn’t work external queries?
- Testing custom API endpoint with class dependency
- apiFetch security
- Not all featured image sizes available in Rest API
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- 403 Forbidden with gutenberg
- Application Password is not enable by default?
- Cannot get ‘sanitize_callback’ to work for rest parameters
- Detect if REST API is running
- Save/update post_meta with Gutenberg from the panel
- How to use current_user_can() in register_rest_route()?
- Set featured image using URL with wp rest api
- WP Rest endpoint with custom post type and ACF Fields
- WP REST API GET Requests require authentication
- What’s the “?P” register rest api construct, what is for and where to find official docs?
- WordPress REST API json – How to activate gzip compression?
- Does it still make sense using json endpoint ep_mask now that there’s the new rest api? [closed]
- WP Remote Request not returning all of content via request
- Custom Post Type and Custom REST API Endpoint result in Gutenberg editor not working
- rest_sanitize_value_from_schema doesn’t sanitize string
- Erratic OAuth 1.0 Signature Mismatch Errors
- WordPress custom endpoint returning blank response
- REST API: best place to set current user for JWT auth?
- REST API authentication for a plugin
- Rest API basic auth not working
- WP_REST_Response() doesn’t seem to return the expected object
- Setting ?context=edit results in rest_forbidden_context, even for an Administrator user
- How to call wp plugin REST functions without curl?
- WP Rest Api- Update callback (POST request) to existing database table through the rest api
- Save default options as an array of options and display in REST API
- WordPress REST Api get posts by ID
- Backbone with custom rest endpoints
- rest Api jwt authentication for get methodes
- [Zapier + WP Webhooks Pro]: Custom Fields get cut off at first comma or semicolon
- Which route in the WP REST API do I access data passed into register_setting()?
- How to use Python to create a Post in WordPress?
- Send a get request to wordpress
- Best Authetication between REST API and Mobile App
- Replace content via rest api only?
- WP rest api endpoint protection using jwt token
- WP Rest API – Change response status code for failed validation request
- Unable to create a Rest end-point
- Log in user using WordPress REST API
- Rest API Paginate until all posts are imported
- Can i fetch the list of pouplar posts of last 24 hours from WordPress API?
- IIS Authorization Rules breaks WP REST-API and results in fail in Site Health
- How to delete all instances of the image using REST API
- Performance of WordPress Rest API vs WordPress Feeds
- trigger WordPress rest any API call
- WordPress Rest Api rest_cannot_edit
- how to create JSON array [] for REST response?
- Getting 401 unauthenticated error in WP Rest API revisions
- How to receive JSON payload from a digital device
- WordPress Custom Rest Api – How to get Image Url?
- Remote publishing using WP’s RetAPI // Issues with HTACCESS
- save_post hook error with REST API
- Connecting WordPress with an External API
- Users REST API not working?
- Using WordPress solely as a Backend – dealing with WP_SITEURL
- phpmailer_init ignored on REST calls
- use WordPress Rest API to build a web application
- REST Request Post including meta/custom fields
- Why wp_set_password not working within a api endpoint?
- WordPress api returns distinct data
- Redefine REST API variables
- Where is the HTML content for my post in the API
- Using WordPress.com API to retrieve featured images
- WordPress Rest API Escapes Returned URLs Forward Slash
- Getting current core version from an WordPress installation
- How to block external access to register_rest_route callback?
- Filter output of posts (Rest API)
- WordPress Application Passwords not authorizing
- Hide custom posts from certain taxonomy in rest api
- Creating Application Password using REST API results in 401 regardless of JWT token