How to allow users login to WP from external domain and make REST requests
How to allow users login to WP from external domain and make REST requests
How to allow users login to WP from external domain and make REST requests
I have the same issue with you, I did cuddle with the issue for a couple of days, I figure out, the problem is not of limitation of 7603, I was found out the problem is actualy with the json_encode. So How to fix this? i made a custom API, and convert my data to … Read more
I think I know the fix. I noticed that the plus sign (+) in the url arguments was automatically being stripped and converted into a space. My arg values ‘august+september’ were becoming ‘august september’ after decoding. I found out that ‘%2B’ is the code equivalent of the + symbol. So, instead of using: /wp-json/wp/v2/events?filter[event_categories]=august+september Use: … Read more
Yes, this can be done. Are you using MediaUpload? Once an image is selected, MediaUpload returns that image object, which includes sizes: full, large, medium etc – this will include any custom sizes you’ve defined. Then, instead of assigned the url to the attribute, you save the url of the size you want. This is … Read more
Yes, from the link you posted there are examples for both sanitising and validating the parameters. Validating does a check which can fail and block the API call from running; sanitising just does some operations to clean or interpret the parameter and does not stop the API call from running. An example of validation, taken … Read more
The credit for this answer really goes to @Wyck who correctly identified the source of the problem. Thank you very much. The reason for the problem is: There is a variance between an import statement in the mainline code versus within a function. In WP or in in any of the plugins if variables aren’t … Read more
I ran into the same problem but for posts. I found how to OR or AND tags together here: https://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters To get entries that have both L1 AND L2 AND L3 ; use plus (+) https://example.com/cms/wp-json/pages?filter[tag]=L1+L2+L3 In case somebody else comes along and wants to OR terms together I’ll save you the trouble: To get … Read more
If you are developing a theme, the proper place to put your code in this case if your theme’s functions.php file. This is the file that is surely going to be run when your website is being accessed. If you are developing a plugin, you can put your code inside a php file (like foo.php) … Read more
We can check out the /wp/v2/clock endpoint’s arguments here: https://myapp.dev/wp-json/wp/v2/ If we add the ‘show_in_rest’ => true, argument, when registering the custom clock_category taxonomy, it will add a support for this GET/POST argument: clock_category: { required: false, default: [ ], description: “Limit result set to all items that have the specified term assigned in the … Read more
you missed something, when you get a product using wc_get_product it returns to you an abstract object, so if you need to get product do this $product = wc_get_product($product_id); return $product->get_data(); also you can use all the other functionalities too, such as: $product->get_status(); $product->get_gallery_image_ids(); …