weglot_noindex_urls
This filter allows you to keep some translated URLs out of the search engines index.
Available since Weglot 6.3.
Some pages are worth translating for your visitors but not worth indexing — a cart, a thank-you page, a landing page that only exists for one market. This filter marks those URLs as noindex in the languages of your choice, without excluding them from translation.
add_filter( 'weglot_noindex_urls', function ( $rules ) {
$rules[] = array(
'value' => '/pricing',
'type' => 'IS_EXACTLY',
'languages' => array( 'fr', 'es' ),
);
return $rules;
} );Rule format
Each rule is an array with the following keys.
value
yes
—
The original path to match, for example /pricing. An absolute URL is accepted and reduced to its path.
type
no
CONTAIN
How value is matched. One of CONTAIN, NOT_CONTAIN, START_WITH, NOT_START_WITH, END_WITH, NOT_END_WITH, IS_EXACTLY, NOT_IS_EXACTLY, MATCH_REGEX.
languages
no
every destination language
Internal language codes the rule applies to. Omit it, or leave it empty, to target every translated version of the page.
A rule without a value, or one whose languages contain no code your project knows, is ignored.
The type values are plain strings, the same ones used by weglot_exclude_urls. They match the constants of Weglot's RegexEnum class, but you do not need to import or reference that class — write the string directly.
Always use the original path
Rules are matched against the original path, never the translated one. If your Spanish version of /pricing is served at /es/precios, the rule is still written /pricing:
This keeps your rules valid even if you later change a translated slug.
The original language is never affected
Whatever the rule says, Weglot never adds noindex to your original language. The SEO of your source pages stays entirely under your control — use your SEO plugin for that.
What Weglot outputs
On a page matched by a rule, in a targeted language, Weglot prints in the <head>:
follow is intentional: the page leaves the index, but search engines keep following its internal links so the rest of your translated site is still discovered.
The tag is printed late, after the one your SEO plugin outputs. You do not need to disable Yoast, Rank Math or any other plugin: when several robots meta tags are present, search engines combine them and apply the most restrictive directives.
Weglot also removes the matching language from the hreflang cluster of that page, in every language. A hreflang pointing at a noindex page is a contradictory signal that search engines discard, and which can invalidate the whole cluster.
Excluding versus not indexing
Page is translated
no
yes
Reachable by visitors
not in that language
yes
Appears in search results
no
no
Use weglot_exclude_urls when a page should not exist in a language at all, and weglot_noindex_urls when it should exist for your visitors but stay out of search results.