Skip to content

Search in the Visitor's Language

WordPress searches the text stored in your database, which is your site’s original language. So a visitor reading your German pages who searches for “Kleid” would normally get nothing, even though the word is right there on the page they’re looking at.

Omnalingo fixes that. On a translated page, a search also matches the translations you have already made, and those pages appear in the results.

Nothing new to learn — the site’s own search box, working in the language being read:

  • Search terms in the visitor’s language find the matching pages, posts and products.
  • Results your site would have returned anyway still appear. A brand name, an article number or a model code keeps working exactly as before.
  • The search box still shows what the visitor typed.

This is on by default and needs no setup. It applies to your theme’s search page, to WooCommerce product search, and to the newer product search and product list blocks.

The translations Omnalingo already holds for the page — the same text you see in the Full Text List and in a page’s string list. Because it searches what is actually rendered, it covers more than a post’s title and body: product attributes, custom fields and page-builder content are all included, as long as the page has been scanned and translated.

Two kinds of text are deliberately left out:

  • Text that appears everywhere — your header, footer, menu and cookie notice. Otherwise a search for a word in your menu would return every page on the site.
  • Text your theme and plugins bring with them — button labels such as “Add to cart”, which are part of the interface rather than the content of any one page.

Omnalingo only ever adds candidates to your site’s own search. Everything else about the search is untouched, so a search restricted to products stays restricted to products, a category filter still narrows, and out-of-stock or hidden products stay hidden.

  • A page has to be scanned and translated to be findable. A page you have not translated yet is findable only by its original text, which is how search behaved before.
  • Word matching, not partial words. Search matches whole words. In languages that glue nouns together — German “Sommerkleid” for a summer dress — searching for “Kleid” finds the compound only if nothing else matched first, when a broader substring search runs as a fallback.
  • Result summaries may still show original-language snippets. WordPress builds those excerpts by cutting text mid-sentence, and a fragment is not something Omnalingo has a translation for.
  • Search plugins that build their own index — such as Relevanssi, SearchWP or FiboSearch with its index enabled — replace WordPress search entirely and are unaffected by this feature.

Some themes and plugins build their result lists with get_posts(), which by default switches off the filters WordPress plugins use to modify a search. Those particular lists — a “related posts” strip, a custom widget — keep searching the original language only. If you maintain such a query and want translated search in it, opt back in:

$posts = get_posts( [
's' => $term,
'post_type' => 'product',
'suppress_filters' => false, // lets Omnalingo widen the search
] );

To switch translated search off entirely, on the whole site:

add_filter( 'omnalingo/search/enabled', '__return_false' );

Searches made through the WordPress REST API are limited to WooCommerce’s Store API, so that editing screens keep searching your original text. To include another endpoint, add its route pattern:

add_filter( 'omnalingo/search/rest_routes', function ( $routes ) {
$routes[] = '#^/?acme/v\d+/things#i';
return $routes;
} );