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 can have the possibility to exclude some pages from the 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 > Exclude URL section. Only add the relative URL of the page that you want to exclude. For example, if your page is www.mywebsite.com/page1/, then only add its relative URL: /page1/
As this section is a regular expression (RegEx), you must separate each pages by comma. Also, don't add any other characters like space. Also note that you won't have to end by a comma, that won't work properly.
If you want to exclude other pages, add only relative URL without anyspace character: /page1/,/page2/,page3/
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 > Exclude block section. There, you can paste the right CSS selector 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. Don't forget to separate each CSS selector with a space.
Click on "Save changes". Then, the navigation bar won't be translated whatever the language is.
3. Translations Tools
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 on 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