WordPress - Edition - How to exclude URLs/blocks/words from translation?

In this article, you'll find how to exclude a specific URL/block/paragraph from being translated in your WordPress website.

1. Exclude URLs

On WordPress, you have the possibility to exclude some pages from translation. That means those pages won't be translated at all and the button will not appear on them.

You can do it directly from your WordPress Dashboard >  Weglot  plugin > Translation Exclusion section, then click on "Add an URL to exclude"

If the URL you would like to exclude is https://www.mywebsite.com/my-page-1, you'll need to add /my-page-1 to the text field and select the option 'URL is exactly'.

The URL exclusion can work with different options:

  • Start with: This option will exclude all the pages that have their slug starting with the input
  • End with: It will exclude all the pages that have their slug ending with the input
  • Contain: It will exclude all the pages that have their slug containing the input
  • Is exactly: It will exclude the page that has it slug identical to the input
  • Match regex: It will exclude the page matching the regex input

If you want to exclude more URLs, click "Add an URL to exclude", and repeat the steps.

The last thing to do is to save changes, and you're good to go!

Note that Weglot doesn't automatically remove the translations related to the excluded pages. Once the pages are excluded, you'll need to manually delete the translations related to these pages. See: How to definitely remove a translation?

2. Exclude blocks

If you want to exclude a specific part of your website like the header, for example, go to your WordPress Dashboard > Weglot plugin > Translation Exclusion section. There, you can paste the right CSS selector (CLASS or ID) of the block.

You can find the CSS selector by right-clicking on the block > Inspect Element.

In this example, you have the choice to exclude either the ID (menu-menu-1) or the CLASS (nav or navbar-nav). No matter the name of the selector, if it's an ID, you must add a sharp "#" before and if it's a CLASS, you must add a dot "." before.

On your WordPress Dashboard >  Weglot plugin > Translation Exclusion section, then click on "Add a block to exclude"

Then, add the class or id of the element in the text field.

You can add as many classes and id as you want by clicking "Add a block to exclude" and repeating the steps.

Click on "Save changes". Then, the navigation bar won't be translated whatever the language is.

Note that Weglot doesn't automatically remove the translations related to the excluded blocks. Once the blocks are excluded, you'll need to manually delete the translations related to these blocks. See: How to definitely remove a translation?

3. Translations Tools

Translation rules do not exclude the content from being translated. It only forces some words to be translated a certain way on your website.

Go to your Weglot account > Translation Tools:

a. Translation Exceptions:

In this section, you can indicate if you want a word/expression to be never translated or translated in a custom way. The rules will be applied to all new translations but won't change the existing translations.

b. Search and Replace rules:

In this section, you can search for a word in all translations and replace it. It is useful if a name has been mistranslated and you want to change it everywhere

Still need help? Contact Us Contact Us