admin管理员组文章数量:1425919
I am using the below to search to check if a product category is already created
$params = [
'search' => "category1"
];
$searchedparaCat = $woocommerce->get('products/categories', $params);
using
This works however it seems to do searches as 'like' instead of absolute. For example the above could return
"category11", "category14", "category14552"....
What I need really is an absolute search so that it will ONLY return a category with the give search term as its slug. Is this possible? I know I can iterate over the returned results and filter them but before I go down that route can this be done via the api?
I am using the below to search to check if a product category is already created
$params = [
'search' => "category1"
];
$searchedparaCat = $woocommerce->get('products/categories', $params);
using https://github/woocommerce/wc-api-php
This works however it seems to do searches as 'like' instead of absolute. For example the above could return
"category11", "category14", "category14552"....
What I need really is an absolute search so that it will ONLY return a category with the give search term as its slug. Is this possible? I know I can iterate over the returned results and filter them but before I go down that route can this be done via the api?
Share Improve this question asked May 28, 2019 at 20:25 DevWithZacharyDevWithZachary 1033 bronze badges1 Answer
Reset to default 1Searches are always fuzzy, not exact. You might be looking for the slug
parameter here. From the documentation, it reads Limit result set to resources with a specific slug.
I assume it should fit your case and it would only return the categories that match the slug provided.
本文标签: woocommerce offtopicAbsolute search against wordpress api
版权声明:本文标题:woocommerce offtopic - Absolute search against wordpress api 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745455214a2659070.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论