Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

weglot_exclude_blocks

This filter allow you to modifiy the array of exclude blocks.

The filter receives the array of CSS selectors whose content is never translated, and must return it. Weglot adds a data-wg-notranslate attribute to every matching element.

add_filter( 'weglot_exclude_blocks', 'custom_weglot_exclude_blocks' );
function custom_weglot_exclude_blocks( $blocks ) {
    $blocks[] = '.customer-reviews';
    return $blocks;
}

The exclusions are ignored as soon as weglot_parser_whitelist returns a non-empty list: the page then only translates the whitelisted blocks.

Last updated