Category : wordpress-rest-api

Currently I am using wp-json rest API (wp-json/wc/v3/). I want to get all products with thumbnail/featured image. Current API gives list of images but not featured/thumbnail image. I am using this API to get products : https://example.com/wp-json/wc/v3/products?status=publish&per_page=20&page=1&skip_cache=1&category=99&consumer_key=c65&consumer_secret=cs_ac77c I am getting all products with their info but not getting thumbnail/featured image. So how to edit this ..

Read more

I need to get some data from an API using an access token and a body so I made the following (randomised the keys and ids): add_action(‘rest_api_init’, ‘wp_rest_user_endpoints’); function wp_rest_user_endpoints($request) { register_rest_route(‘wp/v2’, ‘users/register’, array( ‘methods’ => ‘POST’, ‘callback’ => ‘wc_rest_user_endpoint_handler’, )); } function wc_rest_user_endpoint_handler($request = null) { $response = array(); $parameters = $request->get_json_params(); $userid = ..

Read more

I have created a custom payment plugin now I need to set up an endpoint that will receive webhook callbacks from the payment gateway. My code for the endpoint is as seen below: add_action(‘rest_api_init’, function () { register_rest_route( ‘namespace/v1/’, ‘endpoint’, array ( ‘methods’ => ‘POST’, ‘callback’ => ‘return_payment_status’ ) ); }); function return_payment_status (WP_REST_Request $request_data) ..

Read more

Sorry I feel like really stuck here. I have a plugin introducing a new Rest API controller (WP_REST_Controller) with basically a single endpoint which uses a separate class as a client to fetch some data. Let’s say: class WP_REST_My_Controller extends WP_REST_Controller { /** * Registers the routes. */ public function register_routes() { $namespace = ‘my/namespace’; ..

Read more

I want to add active class only in first element of li this is an amp code …jquery is not working in this properly how will I achieve this kind of logic please help…………………………………………………………………………………………………………………………………………………………… function custom_table_of_contents($content) { global $tableOfContents; global $checkvalue; $tableOfContents = ”; $tableOfContents = "<ul class=’toc-item-list’>"; $checkvalue = 0; $index = 1; $indexes ..

Read more