keepcalculator

06 Numbers and Powers

Multilingual Search in WordPress: How to Add It

Card No. 06·65154 · Updated · Standard formula, shown below

Adding multilingual search to your WordPress site lets visitors search in their own language and get results from content in any language you publish. This guide walks you through setting up a search that respects language settings, using either a translation plugin or a dedicated search extension. You’ll need a WordPress site with at least two languages of content already published, and admin access to install plugins.

What You’ll Need

  • A self-hosted WordPress site (wordpress.org, not the hosted .com version).
  • Admin access to the dashboard.
  • Content already created in at least two languages (posts, pages, or custom post types).
  • A translation plugin if your site isn’t already multilingual (e.g., WPML, Polylang, or TranslatePress).
  • An FTP client or file manager access if you plan to edit theme files directly (optional).

Step-by-Step

  1. Confirm your multilingual setup. If you haven’t already, install and configure a translation plugin. For this guide, we’ll assume you’re using either WPML, Polylang, or TranslatePress. Each creates language-specific versions of your posts and pages. Ensure that each piece of content has a translation assigned to the correct language.
  2. Check your current search behavior. By default, WordPress searches only the posts and pages in the language you’re currently viewing. To test, switch to your secondary language and search for a term that exists only in the primary language. If you get no results, that’s expected—your search is language-restricted.
  3. Decide on your search scope. Do you want search results to show content from all languages, or only the language the visitor is currently using? Most site owners prefer the latter. This guide focuses on the most common setup: search results limited to the current language, but with the ability to switch languages from the results page.
  4. Install a search plugin that supports multilingual. The easiest method is to use a search plugin designed for multilingual sites. Two popular options are:
    • Relevanssi – a powerful search plugin that works well with WPML and Polylang. It indexes all content and respects language filters.
    • SearchWP – a premium plugin with built-in multilingual support for WPML and Polylang.

    For this guide, we’ll use Relevanssi (free version) as an example.

  5. Install and activate the search plugin. In your WordPress admin, go to Plugins → Add New, search for “Relevanssi”, install, and activate.
  6. Configure Relevanssi for multilingual search. Go to Settings → Relevanssi. Under the “Indexing” tab, click “Build the index”. This scans all your content and creates a search index. For multilingual support, ensure the “Index post type” includes all post types you use (posts, pages, etc.). Relevanssi automatically detects the language of each post if you have WPML or Polylang active.
  7. Enable language filtering. In Relevanssi settings, look for the “Restrict search to current language” option (available when WPML or Polylang is detected). Enable it. This ensures that when a visitor searches in English, they only see English results, even if the same content exists in French.
  8. Test your search. Go to your site’s front end, switch to a language, and perform a search. Verify that results are in the correct language. Also test searching for a term that appears in multiple languages—you should see only the current language’s results.
  9. If you use TranslatePress: TranslatePress works differently—it translates the same URL, so search is inherently language-aware. However, if you want search to include all languages, you can use the “SearchWP” plugin, which has a setting to include all languages. For TranslatePress, you may not need any extra configuration.
  10. Customize the search results page (optional). If you want to show a language switcher on the search results page, you can add a language switcher widget to your search results template. With WPML, you can use the language switcher block in the search results page template. With Polylang, use the language switcher widget in your sidebar or footer.
  11. Handle search queries that have no results. If a visitor searches for a term that doesn’t exist in the current language but exists in another, consider showing a “Did you mean?” suggestion or a link to search in other languages. You can implement this with a custom function in your theme’s functions.php file, or use a plugin like “SearchWP” that offers related searches.

Common Mistakes

  • Not building the search index after installing a search plugin. If you skip this, the plugin won’t work at all.
  • Forgetting to enable language filtering. Without it, you’ll get mixed-language results, which confuses visitors.
  • Using a search plugin that doesn’t support your translation plugin. Some search plugins only work with WPML, not Polylang. Check compatibility before installing.
  • Not testing on all languages. A search that works in English might break in a language with special characters (like German umlauts or Arabic script). Always test in each language.
  • Ignoring accent-insensitive search. If your site has Spanish or French content, users may search without accents. Ensure your search plugin supports accent-insensitive matching (Relevanssi does by default).

Tips

  • Use a dedicated search plugin for better relevance. The default WordPress search is basic and doesn’t handle multilingual well. Plugins like Relevanssi or SearchWP improve accuracy and speed.
  • Optimize your index regularly. If you publish new content often, rebuild the search index periodically (Relevanssi can do this automatically via cron).
  • Consider using a translation plugin’s built-in search features. WPML has a “WPML Search” add-on that integrates with Relevanssi. Polylang works with Relevanssi out of the box.
  • Add a language switcher to your search results page. This lets users quickly search again in another language without retyping the query.
  • Use the “SearchWP” plugin if you need advanced control. It allows you to set up separate search engines per language, which is great for large sites.

Troubleshooting

  • Search results are empty. First, check that you’ve built the index in Relevanssi. If you have, check that your content is published and not set to “draft”. Also, verify that the language filter is not too strict—try disabling it temporarily to see if results appear.
  • Results show in the wrong language. This usually means the language filter is not working. Ensure your translation plugin is configured correctly and that each post has a language assigned. Rebuild the index after fixing language assignments.
  • Search is slow. If your site has thousands of posts, indexing can be slow. Try increasing the “Indexing limit” in Relevanssi settings, or upgrade to the premium version which is faster.
  • Search doesn’t find special characters. If your language uses diacritics (é, ü, etc.), make sure your database collation is set to UTF-8. You can change this in phpMyAdmin or ask your host to do it.
  • Search plugin conflicts with your theme. Some themes have custom search forms that don’t use the standard WordPress search. If you see no results, check your theme’s search.php template and ensure it uses the standard loop. You may need to add a filter to make your theme’s search form compatible.

Frequently Asked Questions

Q: Can I use the default WordPress search for multilingual sites?
Yes, but it will only search the current language’s content. If you want cross-language search, you need a plugin.

Q: Which search plugin works with Polylang?
Relevanssi and SearchWP both support Polylang. Relevanssi’s free version is sufficient for most sites.

Q: How do I make search results show a language switcher?
You can add a language switcher widget to your search results page (e.g., in the sidebar) using your translation plugin’s built-in widget or block.

Q: Does multilingual search affect SEO?
No, it doesn’t harm SEO. In fact, it improves user experience, which can positively impact engagement metrics. Just ensure you use hreflang tags for language targeting (your translation plugin usually handles this).

Q: Can I search across all languages at once?
Yes, but it’s not recommended because users typically want results in their own language. If you want this, disable the language filter in Relevanssi or use SearchWP’s “all languages” option.

Q: What if I use a page builder like Elementor?
Page builders don’t affect search. As long as your content is in standard post types, search plugins will index it. Just ensure you rebuild the index after adding new content.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →