I have next code for search using words and category. But, i want add another condition with custom field.

how to do?

I have custom fields with name “State” and value “State1″, “State2″ and “State3″.
I want when i select obtion State 1, to show all article with custom field State - State1.

<option value="">all state</option>
<option value="....">State 1</option>
<option value="...">State 2</option>
<option value="...">State 3</option>


<form method="get" action="<?php bloginfo('url'); ?>">
    <input type="text" name="s" placeholder="search…"/>
    <select name="category_name" class="select">
    <option value="">toate categoriile</option>
    $categories = get_categories();
    foreach ($categories as $category) {
        echo '<option value="', $category->slug, '">', $category->name, "</option>n";
    <button type="submit" class="buton">Search</button>

Read more here: Advance search with custom field wordpress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: