Problem: I have a taxonomy View that responds to a URL parameter, and should filter only terms that begin with that letter. In the past, this View was working correctly but it has begun to show inaccurate results.
Solution: Replace your taxonomy query filter code with the updated version below.
add_filter( 'wpv_filter_taxonomy_query', 'prefix_modify_tax_query', 10, 3 ); function prefix_modify_tax_query( $tax_query_settings, $view_settings, $view_id ) { if($view_id != 62 && isset($_GET['wpvalphabet']) && $_GET['wpvalphabet'] != '' ) { $tax_query_settings['name__like'] = $_GET['wpvalphabet']; } return $tax_query_settings; } function old_style_name_like_wpse_123298($clauses) { remove_filter('term_clauses','old_style_name_like_wpse_123298'); $splits = explode('}', $clauses['where']); $joins = array(); if(sizeof($splits) == 1) { return $clauses; } foreach($splits as $split) { $joins[] = substr($split, 0, strpos($split, '{')); } $clauses['where'] = join($joins, '') . (sizeof($joins) > 1 ? "%'" : ''); return $clauses; } add_filter('terms_clauses','old_style_name_like_wpse_123298');
Relevant Documentation: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_query
https://developer.wordpress.org/reference/hooks/terms_clauses/
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 4 réponses, has 2 voix.
Last updated by morktron Il y a 6 années et 4 mois.
Assisted by: Christian Cox.