Finding search results in custom fields

Asked

Viewed 45 times

0

How does Wordpress search in custom fields?

I researched and saw that his search works using the title and content of the content. I created a project that uses custom fields, such as: address and phone number, with the possibility of the user to enter the city name, address, state or telephone.

The city name is the normal title, the rest of the fields are all custom.

I am using a query to do this, because I am displaying the result via ajax

$string = $_GET['string'];
$argumentos = [
    'post_type' => 'unidade',
    'posts_per_page' => -1,
    's' => $string
];
$posts = new WP_Query($argumentos);
?>
  • What exactly is the question? What do you intend to do?

  • Let wordpress perform the search in custom fields as well

  • Put your query to the question

  • @lazyFox placed is very simple

  • I’m not familiar with Wordpress but while waiting for an answer see this link

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.