Ajax Search Widget

Add instant AJAX search with category, tag and custom taxonomy filters, date filters, Load More or numbered pagination, ACF fields and Elementor Loop Item designs.

Free 2 min read Updated
On this page

Ajax Search shows search results that update instantly as visitors type, pick taxonomy terms or change pages, with no page reload. Initial results are rendered on the server, so they are crawlable by search engines.

#Key options

  • Content types: one or more public post types, including Posts, WooCommerce Products and custom post types.
  • Search fields: title, excerpt and/or full content.
  • Filters: categories, tags, product taxonomies, Featured status and other public taxonomies, shown as buttons or compact dropdowns, with optional multi-select.
  • Date filter: today, past 7 or 30 days, past year, or a custom date range chosen by the visitor.
  • Default state: show all content, pre-select terms, or automatically use the current archive's category/tag/term.
  • Results: built-in responsive cards with a sortable content repeater, or a published Elementor Loop Item template for a fully custom design (it safely falls back to the built-in card if unavailable).
  • ACF fields in the built-in card: current result, fixed post or Options Page sources.
  • Pagination: Load More or accessible numbered AJAX pagination, result counts, product prices, excerpts, images and stable random ordering across pages.

#How filters combine

Search text and every active term are combined in one query.

  • Selecting a category limits results to that category and its child categories.
  • Several selected terms in one group match any of them.
  • Different groups (category + tag + custom taxonomy) are combined so every active group must match.

#Styling

The Style tab has responsive controls for the layout, search input and icon, search button, taxonomy labels, filter buttons (active/hover), date inputs, result count, cards and hover effects, images, badges, dates, titles, excerpts, prices, links, pagination, no-results text, errors and the loading spinner.

#For developers

Modify the query without editing the widget:

add_filter( 'elephanta/ajax_search/query_args', function ( array $query_args, array $widget_config ): array {
    // Example: hide posts older than two years.
    $query_args['date_query'] = array( array( 'after' => '2 years ago' ) );
    return $query_args;
}, 10, 2 );

Listen for updates in JavaScript:

document.addEventListener('elephanta:ajax-search:complete', function (e) {
    // Send an analytics event, refresh a third-party script, etc.
});
Performance

The Ajax Search scripts load only on pages that contain the widget.