WP_Query To call data from diffrent tables

How can i join my request and get data from multiple tables You don’t, instead, you break it into multiple steps, and retrieve by individually For example, lets say I want to list the top 5 posts, and display a piece of user meta about their authors, e.g. a score. That can’t be done in … Read more

Is there anyway to format my EndPoint URL in WordPress?

You don’t. Query args are not part of the route URL. Your endpoint URL is: https://iotkidsiq.com/wp-json/zaindob/v1/sync_order So needs to be registered as: register_rest_route( ‘zaindob/v1’, ‘/sync_order’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘updatetable’, ) ); key and msisdn are arguments that are sent to your endpoint. To define these use set the args property of the … Read more

pagination in WP rest api

define(‘API_ENDPOINT_VERSION’, 1); //flush the rewrite rules on plugin activation function apiendpoint_activate() { flush_rewrite_rules(); } register_activation_hook(__FILE__, ‘apiendpoint_activate’); function apiendpoint_register_endpoints() { register_rest_route( ‘api/v1’, ‘/post’, [ ‘methods’ => ‘GET’, ‘callback’ => ‘api_get_post’, ] ); } add_action(‘rest_api_init’, ‘apiendpoint_register_endpoints’); function api_get_post($request) { $ar = array(‘post_type’ => ‘posts’, ‘posts_per_page’ => 15, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘paged’ => ($_REQUEST[‘paged’] ? … Read more

Woo API REST : product variation price is read-only?

After some research, i found this example : PUT /wp-json/wc/v3/products/<product_id>/variations/<id> So in javascript we could do : const data = { regular_price: “10.00” }; WooCommerce.put(“products/22/variations/733”, data) .then((response) => { console.log(response.data); }) .catch((error) => { console.log(error.response.data); }); And the JSON API Response : { “id”: 733, “date_created”: “2017-03-23T00:53:11”, “date_created_gmt”: “2017-03-23T03:53:11”, “date_modified”: “2017-03-23T00:53:11”, “date_modified_gmt”: “2017-03-23T03:53:11”, “description”: “”, … Read more

Get all PDF files from page with WordPress API

You would get the PDFs by querying mime_type=application/pdf So, based on your example your full URL would be: https://www.domain.com/wp-json/wp/v2/media?parent=1267&mime_type=application/pdf However, it is possible when using the parent=ID parameter, you will see ALL the PDFs, not just the attachments specific to that post. This happens when the PDFs were uploaded to the media library, but not … Read more

Case insensitive header params for API request

This would seem to be a “fault” of the way WordPress (the “server”) is reading the HTTP request headers. (If they are being read into an associative array without any normalisation then the comparison will naturally be case-sensitive.) This should arguably be “fixed” in WP. However, it’s possible to create a “workaround” in .htaccess and … Read more