rest_no_route custom route

The problem is, you are calling a static method from inside of a non-static method. The following will work. class theme_Rest_Routes extends WP_REST_Controller{ public static function init() { $instance = new self(); add_action( ‘rest_api_init’, array( $instance, ‘register_routes’ ) ); } public function register_routes() { register_rest_route( ‘theme/v1’, ‘/menu/’, array( ‘methods’ => ‘GET’, ‘callback’ => array( $this, … Read more

How to modify WCMP Rest API response?

Finally I had solved it! In the source code of the plugin “dc-woocommerce-multi-vendor”, I had viewed the class “class-wcmp-rest-vendors-controller.php” and figured out that they are using this filter in order to gather up the fields of the response: apply_filters(“wcmp_rest_prepare_vendor_object_args”, array(…)); In the functions.php of the child theme I had written this code to edit the … Read more

How to receive data by http POST request

Ok, here’s my answer for what it’s worth. I use this plugin: https://github.com/dphiffer/wp-json-api HOWEVER! This plugin was removed from the official plugin site for unknown reasons. But, I use it for a custom API so I don’t upload the built-in controllers and deactivate the core controller. The way it works: Write your own custom controller … Read more