SearchWP Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP’s many hooks

WPML Integration

This Extension requires a Pro license

Current version: 1.7.3

WPML is a long-standing and widely trusted WordPress plugin that adds multilingual support to websites. It makes it easy to build and manage multilingual sites, whether you’re running a simple blog or a large corporate website.

When the SearchWP WPML Extension is active, it automatically integrates with WPML’s language filtering system. Search results are limited based on the currently active language, ensuring that users only see content relevant to the language they are browsing. This applies to both standard search results and live (AJAX) search results.

In addition to language detection from the current page, SearchWP also supports filtering search results using the lang parameter in the URL. When this parameter is present, SearchWP will return results that match the specified language code.

Non-Translatable Posts

The SearchWP WPML extension includes built-in support for post types that do not have separate translations for each language. In these cases, posts can fall back to the default language instead of returning empty results.

To enable this behavior, you must allow language fallback in WPML’s settings:

  1. Navigate to WPML → Settings in your WordPress dashboard.
  2. Locate the Post Types Translation section.
  3. Enable the option that allows posts in other languages to fall back to the default language when a translation is not available.

Once enabled, SearchWP will be able to return results for these post types even if a translation does not exist for the current language.

Troubleshooting Common Issues

No results showing for certain search terms in a language

On multilingual sites, SearchWP’s keyword stemming feature can sometimes produce unexpected results for specific languages. This occurs because the stemming algorithm doesn’t account for language-specific stemming rules when processing and matching search tokens. Different languages have unique grammatical structures and word formation patterns that may not be properly handled by the general stemming algorithm.

To resolve search issues related to stemming, try disabling the keyword stemming option in your SearchWP engine settings. Disabling stemming for problematic languages often resolves issues where valid search terms fail to return expected results.

If disabling stemming does not resolve the issue, we recommend opening a support ticket so our team can investigate further.

AJAX filtering and language detection

When using SearchWP live search or AJAX-based filtering alongside site caching, WPML may not always detect the correct language for AJAX requests. This can result in search results being returned in the wrong language or not appearing at all.

To fix this, WPML provides an option to store the active language in a cookie for AJAX requests:

  1. In your WordPress admin dashboard, go to WPML → Languages.
  2. Scroll down to the Language filtering for AJAX operations section.
  3. Enable the option “Store a language cookie to support language filtering for AJAX.”
  4. Click Save to apply the changes.

Enabling this option ensures that WPML correctly identifies the current language during AJAX requests, even for non-logged-in users and cached pages. This allows SearchWP to return accurate, language-specific results during live search and filtering operations. 

Changelog

1.7.3

  • [Fix] Improved type safety.
  • [Fix] Undefined array key "language_code" when importing content with the WP Import plugin.

1.7.2

  • [Fix] Support for WPML's translation fallback setting not working in some cases.

1.7.1

  • [Fix] PHP error if WPML is not active.

1.7.0

  • [New] Adds support to SearchWP Search Forms

1.6.11

  • [New] Added support for taxonomy sources.
  • [Improvement] Ensure that query clauses are included only for sources available in the current engine.
  • [Improvement] Prevent extension from running if WPML is not active.
  • [Improvement] Automatically disable Stemming for non supported languages.
  • [Change] Updated multisite support.
  • [Fix] Support for WPML's translation fallback setting not working.

1.6.10

  • [Fix] PHP error when `wpml_post_language_details` WPML filter returns an unexpected WP_Error object
  • [Fix] Deprecation notices on PHP 8.2

1.6.9

  • [Fix] Error in in some cases

1.6.8

  • [Fix] Error in SearchWP 4.1.5+ in some cases

1.6.7

  • [Fix] Issue with multisite search in SearchWP 4
  • [Update] Updated updater

1.6.6

  • [Fix] Handling of blocks in some cases

1.6.5

  • [Improvement] Element type handling when limiting results to current language

1.6.4

  • [Fix] Issue where results were not limited to the current language in some cases

1.6.3

  • [Fix] Compatibility with SearchWP 4
  • [Update] Updated updater

1.6.1

  • [Update] Compatibility with SearchWP 4

1.5.3

  • [Fix] Issue where language limits were not put in place in some cases
  • [New] Support for WPML's translation fallback setting
  • [Update] Updated updater

1.5.2

  • [Fix] All languages returned in limited cases
  • [Fix] PHP Error during indexing

1.5

  • [Fix] Fixes an issue where taxonomy terms were not being translated during indexing
  • [Fix] Account for WPML-defined attachment translations
  • [Change] Reduced aggressiveness in finding unindexed posts to better integrate with Gutenberg
  • [New] New hook searchwp_wpml_aggressive to control whether unindexed post retrieval is more aggressive
  • [Update] Updated updater

1.4

  • [Improvement] Better support for translated taxonomy terms
  • [Update] Updated updater

1.3

  • [Improvement] Added support for auto-updates based on SearchWP license key

1.1

  • [Fix] Fixed an issue that prevented non-default languages from being indexed

1.0

  • Initial release

Create a Better WordPress Search Experience Today

Never lose visitors to unhelpful search results again. SearchWP makes creating your own smart WordPress search fast and easy.

Get SearchWP Now
Multiple Search Engines Icon