-
Notifications
You must be signed in to change notification settings - Fork 17
extend review query for any custom taxonomy and post type #263
Comments
@contactashish13 i see this extended for tags, not all custom taxonomies. also why we don't use in the model two params, taxonomy_name and terms_ids which will filter the reviews based on those?
which will be generally used regardless of any taxonomy the user is choosing ( category, tag, etc ) Also, for backwards compatibility, we can populate the terms_ids based on category_ids or category_name, if provided, for keeping backwards compatibility. |
@selul taxonomy_category and taxonomy_tag allow for any custom taxonomy `
` and the reason I have had to add two is to support tags and categories, not tags or categories |
@contactashish13 I understand now. Can we collapse this into a single taxonomy usage, we don't need filtering by multiple taxonomy at the same time, it will be either tags or category or anything else. I will suggest that we can simplify the input into something like this:
Where term_ids will be either array of slugs or term_ids and the taxonomy is the taxonomy slug which we will be used for filtering, i.e tags, category, download_tag, etc. Following this example, we will reduce the query from In order to have backwards compatibility, we will detect before building the query, if we have values for category_id or category_name and prepopulate the term_ids in this case. In order to know if to detect if the Let me know what do you think about this approach. |
@selul i added support for both tags and categories because related reviews widget does that. The only difference is it uses tags OR categories. Do you want to still simplify the query? |
yep, the logic inside related widgets can be simplified also to reduce only to fetch reviews only for similar tags. What do you think ? |
@selul the current widget works on categories or tags so existing customers who don't tag reviews and tend to group reviews into categories might suffer. |
that's fine for now. |
@selul or we can add an option to the widget where the user can select if they want similarity on the basis of tags or categories. And we can default this to categories. Do you think that would work? |
yep, much better this way. |
@selul done. I've added the pro changes to https://github.com/Codeinwp/wp-product-review-pro/pull/87 |
@contactashish13 can we build some unit tests for this new query model. We can generate from phpunit a batch of posts, tags, categories and test different scenarios for query results. |
@selul added. I'm not sure if the condition to find by rating has been written correctly in the query model because the test I've written (and commented out) fails. Can you please check? |
@contactashish13 SHould this issue be closed? |
@contactashish13 I know that you might not like this but it seems a lot of users requested filtering reviews by custom taxonomies and tags.
In order to do this, we need to extend the wp_query to allow using custom taxonmies, not only categories as it does not.
Let me know if you have any suggestion on how we can do this.
The text was updated successfully, but these errors were encountered: