Term Archive Priority

Current version: 1.2.2 View Changelog

Download available with active license

The Term Archive Priority extension is deprecated
Please use a Taxonomy source instead.

The Term Archive Priority Extension will force taxonomy term archive pages to bubble to the top of search results when a match is found. This allows you to search by taxonomy term and have applicable taxonomy archive pages show up within your search results!

This Extension only applies to supplemental search engines.

Out of the box, all supplemental search engines will apply this change when the plugin is active, but you can filter that down to specific supplemental search engines by doing something like the following:

function my_maybe_include_term_archive( $include, $engine, $terms ) {
// only have term archives included for supplemental search engine with name 'supplemental'
return ( $engine == 'supplemental' ) ? true : false;
add_filter( 'searchwp_term_archive_enabled', 'my_maybe_include_term_archive', 10, 3 );
view raw gistfile1.php hosted with ❤ by GitHub

NOTE: by default, Term Archive Priority supports exact taxonomy term matches. If you would like to enable matching of any word within a taxonomy term, use the following filter:

add_filter( 'searchwp_tax_term_or_logic', '__return_true' );
view raw gistfile1.php hosted with ❤ by GitHub

Once activated, you will need to customize your search results loop so as to account for term archive pages in the results. This is a full theme template example outlining how to properly implement the Term Archive Priority Extension:

Note: The snippet below is for SearchWP 4, if you are using SearchWP 3 view the legacy template.

/* Template Name: SearchWP Term Archive Priority Sample */
global $post;
// Retrieve applicable query parameters.
$search_query = isset( $_GET['searchwp'] ) ? sanitize_text_field( $_GET['searchwp'] ) : null;
$search_page = isset( $_GET['swppg'] ) ? absint( $_GET['swppg'] ) : 1;
// Perform the search.
$search_results = [];
$search_pagination = '';
if ( ! empty( $search_query ) && class_exists( '\\SearchWP\\Query' ) ) {
$searchwp_query = new \SearchWP\Query( $search_query, [
'engine' => 'supplemental', // The Engine name.
'fields' => 'all', // Load proper native objects of each result.
'page' => $search_page,
] );
$search_results = $searchwp_query->get_results();
$search_pagination = paginate_links( array(
'format' => '?swppg=%#%',
'current' => $search_page,
'total' => $searchwp_query->max_num_pages,
) );
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<header class="page-header">
<h1 class="page-title">
<?php if ( ! empty( $search_query ) ) : ?>
<?php printf( __( 'Search Results for: %s' ), esc_html( $search_query ) ); ?>
<?php else : ?>
SearchWP Supplemental Search
<?php endif; ?>
<!-- BEGIN Supplemental Engine Search form -->
<form role="search" method="get" class="search-form"
action="<?php echo site_url( 'search-results/' ); ?>">
<span class="screen-reader-text">
<?php echo _x( 'Search for:', 'label' ) ?>
<input type="search" class="search-field"
placeholder="<?php echo esc_attr_x( 'Search...', 'placeholder' ) ?>"
value="<?php echo isset( $_GET['searchwp'] ) ? esc_attr( $_GET['searchwp'] ) : '' ?>"
title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" />
<input type="submit" class="search-submit"
value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>" />
<!-- END Supplemental Engine Search form -->
<?php if ( ! empty( $search_query ) && ! empty( $search_results ) ) : ?>
<?php foreach ( $search_results as $search_result ) : ?>
<article class="page hentry search-result">
switch( get_class( $search_result ) ) {
case 'WP_Post':
$post = $search_result;
<header class="entry-header"><h2 class="entry-title">
<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a>
<div class="entry-summary"><?php the_excerpt(); ?></div>
case 'SearchWPTermResult':
<header class="entry-header"><h2 class="entry-title">
<a href="<?php echo $search_result->link; ?>">
<?php echo $search_result->taxonomy; ?>: <?php echo $search_result->name; ?>
<div class="entry-summary">
<p><?php echo $search_result->description; ?></p>
<?php endforeach; ?>
<?php if ( $searchwp_query->max_num_pages > 1 ) : ?>
<div class="navigation pagination" role="navigation">
<h2 class="screen-reader-text">Results navigation</h2>
<div class="nav-links"><?php echo wp_kses_post( $search_pagination ); ?></div>
<?php endif; ?>
<?php elseif ( ! empty( $search_query ) ) : ?>
<p>No results found, please search again.</p>
<?php endif; ?>
</main> <!-- .site-main -->
</div> <!-- .content-area -->
<?php get_footer(); ?>



  • [Fix] Results handling in some cases
  • [Fix] Unwanted application when performing Admin searches in some cases
  • [Update] Updated updater


  • [Fix] PHP Warning
  • [Update] Updated updater


  • [New] Support for SearchWP 4


  • [New] Support for Live Search
  • [Update] Updated updater


  • [Fix] Number of arguments passed to searchwp_term_archive_term_args
  • [Fix] Fatal Error when SearchWP is not active
  • [Fix] Check for SearchWP core partial matching setting


  • [Fix] Fixes an issue with shared taxonomies not appearing in results


  • [Fix] Fixes an issue with Live Search integration being too assumptive, it is now opt-in
  • [New] New filter searchwp_term_archive_live_search to opt in to Live Search integration


  • [New] New filter searchwp_term_archive_term_args
  • [Improvement] Better support for Live Ajax Search searches
  • [Update] Updated updater


  • [Change] Empty terms are no longer ignored by default when using OR/%LIKE% matching
  • [New] New filter searchwp_term_archive_term_args to customize OR/%LIKE% arguments


  • [Fix] Fixed an issue with improper results containing terms spanning multiple post types
  • [Update] Updated updater


  • [Improvement] Better integration with LIKE Terms/Fuzzy Matches for martial term matching


  • [Improvement] Automatic updates based on your SearchWP license key


  • [Improvement] Formatting


  • [Fix] Better offset handling
  • [Fix] PHP Warning cleanup
  • [Improvement] Results now ordered by the weight of their taxonomy


  • [New] New filter searchwp_tax_term_or_logic that allows OR logic in multi-word terms


  • [Fix] Fixed an issue where disabled post types were not taken into account


  • [Fix] Fixed an issue where taxonomies were being set before custom taxonomies were registered
  • [Improvement] Consider multi-word terms


  • Initial release

Want to make your search awesome right now?

More than 30,000 sites have chosen SearchWP!

You can utilize all of the content that’s gone unrecognized by native WordPress keyword search instantly with SearchWP.

Get SearchWP for just $99

  • Committed Support
    If you need help, support is fast, friendly, and here for you
  • Streamlined Setup
    Installation and setup that’s optimized for speed
  • Great Documentation
    Helpful, clear, and usable documentation is a priority

See what SearchWP customers have to say

  • “SeachWP is easy to set up and has all the customizing I need to help my clients deliver a better search experience than the native WP search functionality. It also has great analytics that help their content strategy.”

  • “we use searchwp on numerous projects, as it is a well coded plugin that extends wordpress on vital functions for data-heavy websites.”

  • “This plugin is awesome! I can easily manipulate the search results without coding. It’s easy to use and easy to configure. I wish all plugins were like this. This plugin just works.”