Skip to main contentSkip to footer

By default, Relevanssi does not index trashed posts. If you want to enable searching for trashed posts in the WordPress admin, it’s simple: all you need to do is to give Relevanssi permission to a) include posts with the trash status in the index and b) allow the trash status posts to show up in the admin search.

Doing this requires a small bit of code:

add_filter( 'relevanssi_valid_status', 'rlv_include_trash' );
add_filter( 'relevanssi_valid_admin_status', 'rlv_include_trash' );
function rlv_include_trash( $statuses ) {
    $statuses[] = 'trash';
    return $statuses;
}

Add this code to your site and then rebuild the index to include trashed posts in the admin search results.

This function does both jobs at once: it adds trash to the list of allowed statuses for indexed posts (the relevanssi_valid_status filter hook) and to the list of allowed statuses in admin searches (the relevanssi_valid_admin_status filter hook).

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Exact matches for short search terms

…add_filter( ‘relevanssi_term_where’, ‘rlv_three_exact_four_fuzzy’, 10, 2 ); function rlv_three_exact_four_fuzzy( $where, $term ) { if ( relevanssi_strlen( $term ) <= 3 ) { $where = “(relevanssi.term = ‘$term’)”; } return $where; } Add this to your site and set Relevanssi to use partial matching in the searching settings. Now searches with search…

Adding a search form in the navigation menu

…the SearchWP Modal Search Form. As the name says, the plugin is from the SearchWP developer Jon Christopher, but it also works great with Relevanssi. This plugin can easily add a search feature to your navigation menu or a site header. The search form also works great on mobile devices….…header. That’s a good reference if you want to build a nice search form in the header. If your theme does not include a built-in search form and you’re not interested in building one yourself, one of the best plugin options is the SearchWP Modal Search Form. As the name…WordPress doesn’t make adding a search form in the navigation menu easy. It’s a popular request, though, and having access to the search in the site header is typical. Relevanssi itself doesn’t have opinions on the user interface. Some themes, like Twenty Twenty, include a built-in search feature in the…

Related Posts:

Comment Section:

6 Comments. Leave new

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed