0

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 ?

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'
  ) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.