0

If I have a form:

<form class="search" action="<?php echo site_url(); ?>/page-search?category=2" method="get">
    <input type="text" required name="search" placeholder="Search">
    <button type="submit" class="sprite-psuedo"></button>
</form>

How would I add the custom page-search,

The

<?php
global $query_string;

$query_args = explode("&", $query_string);
$search_query = array();

foreach($query_args as $key => $string) {
    $query_split = explode("=", $string);
    $search_query[$query_split[0]] = urldecode($query_split[1]);
} // foreach

$search = new WP_Query($search_query);
?>

From Tutorial does not work. (Outputs nothing, it doesn't really seem to do anything). I tried too loop as well..

How do I process the form?

-2

Try fetching as $_GET['category'].

Then u can use it whichever way u like

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.