plugins - wp meta_query meta_value compare =REGEXP delimited by space

admin2025-01-07  4

searching for custom_tel inside custom post type for meta value

example in database it is save like this 75213332 bla bla bla bla ..

what i have done sent 75213332 and did REGEXP but that did not work good it return custom_tel that not equal to 75213332

part of WP_Query()

  array(
  'key' => 'custom_tel',
  'value' =>'^'.$tel.'@',
  'compare' => 'REGEXP'
  ); 

please help ?

searching for custom_tel inside custom post type for meta value

example in database it is save like this 75213332 bla bla bla bla ..

what i have done sent 75213332 and did REGEXP but that did not work good it return custom_tel that not equal to 75213332

part of WP_Query()

  array(
  'key' => 'custom_tel',
  'value' =>'^'.$tel.'@',
  'compare' => 'REGEXP'
  ); 

please help ?

Share Improve this question edited Dec 21, 2016 at 16:58 sdx11 asked Dec 21, 2016 at 16:40 sdx11sdx11 414 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

solution for this question is :

taking the example above 75213332 bla bla bla bla .. to search for all post that have the custom_tel 75213332 the REGEXP will be ^(75213332) so in this case

array(
  'key' => 'custom_tel',
  'value' =>'^('.$tel.')',
  'compare' => 'REGEXP'
  ) 
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736264171a947.html

最新回复(0)