Alexander
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Show only search results with the search string at the beginning
Started by: Alexander
in: Toolset Professional Support
Problem: Solution: Following is an example of such code, which needs editing for the ID(s) of the View(s) it should apply to, and the custom fields which should use this approach: function tssupp_filter_query($view_args, $view_settings, $view_id) { $views = array( 167 ); // comma-separated array of View IDs to modify $fields = array( 'wpcf-searchable' ); // comma-separated array of fields to modify filter of, including wpcf- prefix if ( in_array($view_id, $views ) && isset( $view_args['meta_query'] ) ) { $meta_queries = $view_args['meta_query']; foreach ($meta_queries as $key => $meta_query) { if ( in_array( $meta_query['key'], $fields ) ){ $view_args['meta_query'][$key]['value'] = '^'.$meta_query['value']; $view_args['meta_query'][$key]['compare'] = 'REGEXP'; } } } return $view_args; } add_filter('wpv_filter_query', 'tssupp_filter_query', 101, 3); Relevant Documentation: |
2 | 4 | 5 years, 6 months ago | ||
Custom field filter showing incorrect results
Started by: Alexander in: Toolset Professioneller Support |
2 | 6 | 5 years, 6 months ago | ||
Query filter not returning correct results after update to Views 2.7
Started by: Alexander in: Toolset Professional Support |
2 | 2 | 6 years, 1 month ago |