Tutorial: Creating a custom job search form

Note: All code examples on this site are provided for developer reference/guidance only and we cannot guarantee that they will always work as expected. Our support policy does not include assistance with modifying or debugging code from any code examples, and they may be changed or removed if we find they no longer work due to changes in our plugins.

The [jobs] shortcode will use search_location and search_keywords variables from the query string. This makes it easy to create a search form elsewhere on your site which redirects to your jobs page.

Here is an example form, which will add a category selection dropdown to the search filters for job listings:

<form method="GET" action="YOUR_JOBS_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_job_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" />

To use this,  create a template override of the job_filters.php template.

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

Code Snippets Documentation