How can we help?

Creating a custom event search form

WP Event Manager’s [Events] shortcode is coded to pick up search_location and search_keywords variables from the query string. Because of this, it’s easy to create a search form elsewhere on your site which posts to your events page.

How to Create a custom event search form

Here is an example form:

<form method="GET" action="YOUR_EVENTS_PAGE_URL">
    <label for="keywords">Keywords</label>
    <input type="text" id="search_keywords" name="search_keywords" />
    <label for="keywords">Location</label>
    <input type="text" id="search_location" name="search_location" />
    <label for="search_category">Category</label>
    <select id="search_category" name="search_category">
        <?php foreach ( get_event_listing_categories() as $cat ) : ?>
            <option value="<?php echo esc_attr( $cat->term_id ); ?>"><?php echo esc_html( $cat->name ); ?></option>
        <?php endforeach; ?>
    <input type="submit" value="Search" />

Replace YOUR_EVENTS_PAGE_URL with the URL to your events page (assuming filters are enabled) and the form will function.

Was this article helpful?
How can we improve this article?
How Can We Improve This Article?
Quick Links