0

I have a website with several custom fields, however when using the following code to search for a post, it only searches for the title or for the content, excluding the custom fields associated with the post or entry.

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
  <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="<?php esc_attr_e( 'Buscar por título, actor, año...', 'twentyeleven' ); ?>" />
  <input type="submit" class="submit" name="submit" id="boton" value="" />
</form>

any way to include custom fields in the search?

2 Answers 2

0

you can create your own search creating a file called search.php in your theme, there you can customize your search however you want.

probably you already have a way to call it, however you can call it with

get_search_form();
0

Tiago's answer will work if you wanna get coding. This plugin does exactly what you want in case you don't mind adding a new plugin to your install.

https://www.relevanssi.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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