Alexander
Fils de soutien créés au cours des 30 derniers jours : 0
Sujets de forum favoris
This user has no favorite topics.
Sujets de forum créés
Status | Sujet | Supporter | Voix | Publications | Nouveauté |
---|---|---|---|---|---|
Show only search results with the search string at the beginning
Commencé par : 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 | Il y a 5 années et 6 mois | ||
Custom field filter showing incorrect results
Commencé par : Alexander in: Toolset Professioneller Support |
2 | 6 | Il y a 5 années et 6 mois | ||
Query filter not returning correct results after update to Views 2.7
Commencé par : Alexander in: Toolset Professional Support |
2 | 2 | Il y a 6 années et 1 mois |