WordPress - How to exclude from translation all pages except specific one(s)?
In this article, you'll find how to exclude every pages from translation except specific ones.
Go to your WordPress Dashboard > Weglot plugin > Exclude URL section.
There, you'll normally be able to add the pages you would like to exclude.
There's a way to say "exclude everything except..". This is possible with regular expressions (RegEx).
Little reminder: the Exclude URL section is working with relative URLs. For example, if your page is www.mywebsite.com/mypage/, then /mypage/ is the relative URL.
Tips for the Exclude URL section with regular expressions (RegEx)
- Exclude everything except a specific page using its relative URL: ^(?!/mypage/$).*
- Exclude everything except the landing page: ^(?!\/$).*
- Exclude everything except a few specific pages: ^(?!/$|/shop/$|/categorie-produit/$|/produit/$).*
- Exclude everything except every pages that begin by /product/... ^(?!/product/).* (Meaning, without the "$")