Translate WordPress with Weglot 2.0 icon
Multilingual & Translation

Translate WordPress with Weglot 2.0 hooks reference

  • By Weglot Translate Team
  • v6.4.3
  • Updated

Translate WordPress with Weglot 2.0 6.4.3 has 4 actions and 165 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when Translate WordPress with Weglot 2.0 fires an action
add_action( 'weglot_another_redirect_override', function( $request_url ) {
	// Your code runs here.
}, 10, 1 );

// Change a value Translate WordPress with Weglot 2.0 is about to use
add_filter( 'weglot_custom_settings_data', function( $settings, $arg2 ) {
	// Change $settings here.
	return $settings;
}, 10, 2 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • src/actions/front/class-translate-page-weglot.php line 593
    /**
     * Allow developers to alter inline Weglot settings before they are
     * JSON-encoded.
     */
    apply_filters( 'weglot_custom_settings_data', $settings, array( 'current_language' => $this->current_language ? $this->current_language->getInternalCode() : null, 'original_path' => isset( $settings['original_path'] ) ? $settings['original_path'] : null, ) );
  • src/services/class-noindex-service-weglot.php line 59
    /**
     * Allow developers to keep some translated URLs out of the index.
     */
    apply_filters( 'weglot_noindex_urls', array() );
  • wp_doing_ajax

    filter
    weglot-compatibility.php line 23
    /**
     * Filters whether the current request is a WordPress Ajax request.
     */
    apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
  • src/helpers/class-helper-api.php line 66 · used in 3 places
    apply_filters( 'weglot_environment', WEGLOT_ENV );
  • src/services/class-option-service-weglot.php line 454 · used in 3 places
    apply_filters( 'weglot_get_api_key', trim( (string) constant( 'WEGLOT_API_KEY' ) ) );
  • src/services/class-option-service-weglot.php line 320 · used in 3 places
    apply_filters( 'weglot_get_options', array_merge( $this->get_options_bdd_v3(), $body ) );
  • src/actions/admin/class-options-weglot.php line 305 · used in 3 places
    apply_filters( 'weglot_get_options_from_cdn_cache_duration', 300 );
  • src/services/class-translate-service-weglot.php line 263 · used in 3 places
    apply_filters( 'weglot_html_treat_page', $translated_content );
  • src/services/class-request-url-service-weglot.php line 285 · used in 3 places
    apply_filters( 'weglot_is_eligible_url', false, $weglot_url );
  • src/actions/front/class-translate-page-weglot.php line 668 · used in 2 places
    apply_filters( 'force_js_render_switcher', false );
  • src/services/class-request-url-service-weglot.php line 56 · used in 2 places
    apply_filters( 'use_custom_path_for_path_check', false );
  • src/actions/front/class-front-menu-weglot.php line 105 · used in 2 places
    apply_filters( 'weglot_autoredirect_no_follow', false );
  • src/services/class-button-service-weglot.php line 169 · used in 2 places
    apply_filters( 'weglot_button_html', $button_html, $add_class );
  • src/services/class-translate-service-weglot.php line 269 · used in 2 places
    apply_filters( 'weglot_escape_attribute_in_html', false );
  • src/services/class-translate-service-weglot.php line 248 · used in 2 places
    apply_filters( 'weglot_escape_attribute_in_json', false );
  • src/services/class-translate-service-weglot.php line 285 · used in 2 places
    apply_filters( 'weglot_escape_script_templates', false );
  • src/services/class-translate-service-weglot.php line 273 · used in 2 places
    apply_filters( 'weglot_escape_vue_js', false );
  • src/services/class-option-service-weglot.php line 477 · used in 2 places
    apply_filters( 'weglot_get_version', 1 );
  • src/services/class-href-lang-service-weglot.php line 41 · used in 2 places
    apply_filters( 'weglot_href_lang', $render );
  • src/services/class-replace-url-service-weglot.php line 211 · used in 2 places
    apply_filters( 'weglot_length_replace_a', 1500 );
  • src/actions/front/class-translate-page-weglot.php line 519 · used in 2 places
    apply_filters( 'weglot_remove_google_translate', true );
  • src/actions/class-email-translate-weglot.php line 71 · used in 2 places
    apply_filters( 'weglot_translate_email', $this->option_services->get_option( 'email_translate' ), $args );
  • src/services/class-redirect-service-weglot.php line 177 · used in 2 places
    apply_filters( 'weglot_url_auto_redirect', $this->request_url_services->get_weglot_url()->getForLanguage( $best_language, true ) );
  • weglot.php line 425
    apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
  • src/actions/class-register-widget-weglot.php line 136
    apply_filters( 'allowed_html_filter', $allowed_html );
  • src/third/woocommerce/class-wc-filter-urls-weglot.php line 355
    apply_filters( 'custom_cart_slug', 'cart' );
  • src/third/woocommerce/class-wc-filter-urls-weglot.php line 335
    apply_filters( 'custom_checkout_slug', 'checkout' );
  • src/services/class-option-service-weglot.php line 365
    apply_filters( 'custom_http_request_timeout', 3 );
  • src/services/class-request-url-service-weglot.php line 60
    apply_filters( 'custom_path_to_check', $default_path );
  • src/actions/front/class-translate-page-weglot.php line 438
    apply_filters( 'custom_trailing_slash_exclusions', [ '/robots.txt', '/sitemap_index.xml', '/wp-sitemap.xml', '/favicon.ico', '/apple-touch-icon.png', '/apple-touch-icon-precomposed.png', '/crossdomain.xml', '/ads.txt', '/humans.txt', '/browserconfig.xml', '/site.webmanifest', ] );
  • src/actions/admin/class-pages-weglot.php line 84
    apply_filters( 'display_admin_bar_menu_weglot', true, $role, $email );
  • src/actions/front/class-translate-page-weglot.php line 254
    apply_filters( 'manage_trailing_slash', false );
  • src/actions/front/class-front-menu-weglot.php line 283
    apply_filters( 'weglot_active_current_menu_item', false );
  • src/services/class-option-service-weglot.php line 353
    apply_filters( 'weglot_active_slugs', true );
  • src/services/class-user-api-service-weglot.php line 169
    apply_filters( 'weglot_active_sslverify', true );
  • src/actions/class-register-widget-weglot.php line 88
    apply_filters( 'weglot_active_switcher_sanitizer', true );
  • src/services/class-translate-service-weglot.php line 172
    apply_filters( 'weglot_active_translation', true );
  • src/actions/front/class-translate-page-weglot.php line 248
    apply_filters( 'weglot_active_translation_before_process', true );
  • src/actions/front/class-translate-page-weglot.php line 266
    apply_filters( 'weglot_active_translation_before_treat_page', true );
  • src/helpers/class-helper-filter-url-weglot.php line 44
    apply_filters( 'weglot_active_wp_redirect', true );
  • src/actions/front/class-translate-page-weglot.php line 528
    apply_filters( 'weglot_add_hreflang', true );
  • src/services/class-translate-service-weglot.php line 247
    apply_filters( 'weglot_add_json_keys', array() );
  • src/services/class-replace-link-service-weglot.php line 67
    apply_filters( 'weglot_add_trailing_slash', true );
  • src/services/class-translate-service-weglot.php line 402
    apply_filters( 'weglot_ai_disclaimer_text', $disclaimer_text );
  • src/actions/front/class-translate-page-weglot.php line 182
    apply_filters( 'weglot_ajax_no_translate', array( 'add-menu-item', 'query-attachments', 'avia_ajax_switch_menu_walker', 'query-themes', 'wpestate_ajax_check_booking_valability_internal', 'wpestate_ajax_add_booking', 'wpestate_ajax_check_booking_valability', 'mailster_get_template', 'mmp_map_settings', 'elementor_ajax', 'ct_get_svg_icon_sets', 'oxy_render_nav_menu', 'hotel_booking_ajax_add_to_cart', 'imagify_get_admin_bar_profile', 'el_c... );
  • src/services/class-replace-url-service-weglot.php line 122
    apply_filters( 'weglot_ajax_replace_urls', [ 'redirecturl', 'url', 'link' ] );
  • src/actions/front/class-translate-page-weglot.php line 912
    apply_filters( 'weglot_allowed_urls', $default_allowed_urls );
  • src/third/yoast/class-redirect-handler-weglot.php line 57
    do_action( 'weglot_another_redirect_override', $this->request_url );
  • src/actions/front/class-translate-page-weglot.php line 870
    apply_filters( 'weglot_autoredirect_js', false );
  • src/actions/front/class-translate-page-weglot.php line 301
    apply_filters( 'weglot_autoredirect_only_home', false );
  • src/actions/front/class-translate-page-weglot.php line 302
    apply_filters( 'weglot_autoredirect_skip', false );
  • src/third/cacheenabler/class-cache-enabler-active.php line 37
    apply_filters( 'weglot_cache_enabler_is_active', $active );
  • src/third/calderaforms/class-caldera-active.php line 30
    apply_filters( 'weglot_caldera_forms_is_active', $active );
  • bootstrap.php line 157
    apply_filters( 'weglot_cancel_init', false );
  • src/services/class-button-service-weglot.php line 190
    apply_filters( 'weglot_change_open_close_tag_switcher', false );
  • src/services/class-replace-url-service-weglot.php line 315
    apply_filters( 'weglot_check_multisite_other_paths', true );
  • src/actions/admin/class-metabox-visual-editor-weglot.php line 61
    apply_filters( 'weglot_column_post_type', array( 'post', 'page', ) );
  • src/third/contactform7/class-contactform7-active.php line 34
    apply_filters( 'weglot_contactform7_is_active', $active );
  • src/services/class-option-service-weglot.php line 1165
    apply_filters( 'weglot_css_custom_inline', $this->get_option( 'override_css' ) );
  • src/actions/front/class-translate-page-weglot.php line 272
    apply_filters( 'weglot_debug_file', WEGLOT_DIR . '/content.html' );
  • src/services/class-request-url-service-weglot.php line 156
    apply_filters( 'weglot_default_current_language_empty', $this->language_services->get_original_language() );
  • src/actions/front/class-translate-page-weglot.php line 996
    apply_filters( 'weglot_defer_dynamics_js', false );
  • src/services/class-option-service-weglot.php line 1074
    apply_filters( 'weglot_destination_languages_full', $destination_languages );
  • src/actions/front/class-translate-page-weglot.php line 963
    apply_filters( 'weglot_dynamics_selectors', $default_dynamics );
  • src/services/class-parser-service-weglot.php line 299
    apply_filters( 'weglot_escape_attributes', [] );
  • src/services/class-parser-service-weglot.php line 377
    apply_filters( 'weglot_escape_script_classes', [] );
  • src/services/class-parser-service-weglot.php line 381
    apply_filters( 'weglot_escape_script_contains', [] );
  • src/services/class-parser-service-weglot.php line 370
    apply_filters( 'weglot_escape_script_ids', [ 'tmpl-*', 'nf-*', '*-js-extra', ] );
  • src/services/class-parser-service-weglot.php line 361
    apply_filters( 'weglot_escape_script_types', [ 'text/template', 'text/html', 'text/x-template', 'text/x-handlebars-template', ] );
  • src/services/class-option-service-weglot.php line 1046
    apply_filters( 'weglot_exclude_blocks', $exclude_blocks );
  • src/services/class-option-service-weglot.php line 1156
    apply_filters( 'weglot_exclude_urls', $exclude_urls );
  • src/actions/front/class-translate-page-weglot.php line 964
    apply_filters( 'weglot_excluded_blocks_selectors', $default_excluded_blocks );
  • src/services/class-feature-flags-service-weglot.php line 25
    apply_filters( 'weglot_feature_flags', $settings );
  • src/services/class-option-service-weglot.php line 1174
    apply_filters( 'weglot_flag_css', $this->get_option( 'flag_css' ) );
  • src/services/class-translate-service-weglot.php line 196
    apply_filters( 'weglot_force_translate_cart', false );
  • src/third/formstack/class-formstack-active.php line 30
    apply_filters( 'weglot_formstack_is_active', $this->has_embed() );
  • src/third/formstack/class-formstack-weglot.php line 125
    apply_filters( 'weglot_formstack_selectors', self::DEFAULT_SELECTORS );
  • src/services/class-generate-switcher-service-weglot.php line 200
    apply_filters( 'weglot_generate_switcher_from_dom', $dom );
  • src/services/class-button-service-weglot.php line 133
    apply_filters( 'weglot_get_class_dropdown', $class );
  • src/services/class-translate-service-weglot.php line 194
    apply_filters( 'weglot_get_current_canonical_url', false );
  • src/services/class-dom-checkers-service-weglot.php line 38
    apply_filters( 'weglot_get_dom_checkers', $checkers );
  • src/services/class-button-service-weglot.php line 71
    apply_filters( 'weglot_get_flag_class', $flag_class );
  • src/services/class-button-service-weglot.php line 102
    apply_filters( 'weglot_get_name_with_language_entry', $name, $language_entry );
  • src/services/class-option-service-weglot.php line 835
    apply_filters( 'weglot_get_option', $options[ $key ], $key, $options );
  • src/services/class-option-service-weglot.php line 182
    apply_filters( 'weglot_get_options_from_cdn_cache', true );
  • src/services/class-parser-service-weglot.php line 157
    apply_filters( 'weglot_get_parser_ignored_nodes', $parser->getIgnoredNodesFormatter()->getIgnoredNodes() );
  • src/services/class-regex-checkers-service-weglot.php line 101
    apply_filters( 'weglot_get_regex_checkers', $checkers );
  • weglot-functions.php line 272
    apply_filters( 'weglot_get_rest_current_url_path', $path );
  • src/services/class-option-service-weglot.php line 413
    apply_filters( 'weglot_get_slugs_cache_duration', 0 );
  • src/services/class-option-service-weglot.php line 254
    apply_filters( 'weglot_get_slugs_from_cache', true );
  • src/services/class-option-service-weglot.php line 1183
    apply_filters( 'weglot_get_translation_engine', $this->get_option( 'translation_engine' ) );
  • src/actions/front/class-translate-page-weglot.php line 977
    apply_filters( 'weglot_hide_switcher_js', true );
  • src/actions/front/class-translate-page-weglot.php line 260
    do_action( 'weglot_init_before_translate_page' );
  • src/actions/front/class-translate-page-weglot.php line 228
    do_action( 'weglot_init_start' );
  • src/services/class-option-service-weglot.php line 992
    apply_filters( 'weglot_inside_exclusions_block', $transformed_array );
  • src/services/class-translate-service-weglot.php line 76
    apply_filters( 'weglot_is_wp_engine_hosting', false );
  • src/third/iubenda/class-iubenda-active.php line 38
    apply_filters( 'weglot_iubenda_is_active', $active );
  • src/services/class-translate-service-weglot.php line 257
    apply_filters( 'weglot_json_treat_page', $translated_content );
  • src/services/class-language-service-weglot.php line 76
    apply_filters( 'weglot_language_code_replace', array() );
  • src/services/class-replace-url-service-weglot.php line 216
    apply_filters( 'weglot_length_replace_tags', 2000 );
  • src/actions/front/class-translate-page-weglot.php line 874
    apply_filters( 'weglot_load_dynamics_in_original_language', true );
  • src/actions/front/class-translate-page-weglot.php line 930
    apply_filters( 'weglot_load_dynamics_script', $load_script );
  • src/third/mailoptin/class-mailoptin-active.php line 36
    apply_filters( 'weglot_mailoptin_forms_is_active', $active );
  • src/third/maintenance/class-maintenance-active.php line 37
    apply_filters( 'weglot_maintenance_is_active', $active );
  • src/actions/front/class-front-menu-weglot.php line 155
    apply_filters( 'weglot_menu_parent_menu_item_title', $title );
  • src/helpers/class-helper-menu-options-weglot.php line 31
    apply_filters( 'weglot_menu_switcher_options', array( array( 'key' => self::HIDE_CURRENT, 'title' => __( 'Hide the current language', 'weglot' ), ), ) );
  • src/services/class-menu-options-service-weglot.php line 29
    apply_filters( 'weglot_menu_switcher_options_default', array_map( function() { return false; }, array_flip( $keys ) ) );
  • src/helpers/class-helper-menu-options-weglot.php line 48
    apply_filters( 'weglot_menu_switcher_options_keys', array( self::HIDE_CURRENT, self::DROPDOWN, ) );
  • src/actions/admin/class-metabox-visual-editor-weglot.php line 84
    apply_filters( 'weglot_metabox_post_type', array( 'post', 'page', ) );
  • src/third/minimalcomingsoon/class-minimal-coming-soon-active.php line 37
    apply_filters( 'weglot_minimal_coming_soon_is_active', $active );
  • src/services/class-translate-service-weglot.php line 179
    apply_filters( 'weglot_modify_original_content', $content, $this->current_language, $this->original_language );
  • src/services/class-redirect-service-weglot.php line 121
    apply_filters( 'weglot_navigator_language', $navigator_languages );
  • src/third/ninjaforms/class-ninja-active.php line 36
    apply_filters( 'weglot_ninja_forms_is_active', $active );
  • src/services/class-replace-link-service-weglot.php line 141
    apply_filters( 'weglot_no_replace_a_href', 'wp-content/uploads' );
  • src/actions/front/class-translate-page-weglot.php line 156
    apply_filters( 'weglot_page_builder_query_params', array( 'elementor-preview', '_breakdance_doing_ajax', 'in-front-editor', 'is-editor-iframe', 'brizy_media', ) );
  • src/services/class-parser-service-weglot.php line 133
    apply_filters( 'weglot_parser_config_provider', new ServerConfigProvider() );
  • src/services/class-parser-service-weglot.php line 127
    apply_filters( 'weglot_parser_whitelist', array() );
  • src/services/class-translate-service-weglot.php line 279
    apply_filters( 'weglot_preserve_words_enabled', false );
  • src/services/class-translate-service-weglot.php line 280
    apply_filters( 'weglot_preserve_words_list', array(), $content );
  • src/actions/front/class-search-weglot.php line 97
    apply_filters( 'weglot_prevent_search_translation', false, $current_language, $query );
  • src/actions/front/class-translate-page-weglot.php line 965
    apply_filters( 'weglot_proxify_iframes', $default_proxify_iframes );
  • src/services/class-replace-url-service-weglot.php line 167
    apply_filters( 'weglot_proxify_urls', [] );
  • src/actions/front/class-search-weglot.php line 89
    apply_filters( 'weglot_query_vars_check', 's' );
  • src/third/woocommerce/class-wc-filter-urls-weglot.php line 220
    apply_filters( 'weglot_redirect_woocommerce_filter_reset_password', true );
  • src/third/amp/class-amp-service-weglot.php line 26
    apply_filters( 'weglot_regex_amp', $regex );
  • src/services/class-replace-link-service-weglot.php line 211
    apply_filters( 'weglot_regex_tags_limit', $regex_limit_default );
  • templates/admin/v2/settings.php line 13
    apply_filters( 'weglot_register_url', Helper_API::get_register_url( true ) );
  • src/services/class-generate-switcher-service-weglot.php line 79
    apply_filters( 'weglot_render_default_button', $dom );
  • src/services/class-translate-service-weglot.php line 521
    apply_filters( 'weglot_render_dom', $dom );
  • src/services/class-generate-switcher-service-weglot.php line 146
    apply_filters( 'weglot_render_switcher_editor_button', $dom );
  • src/services/class-generate-switcher-service-weglot.php line 49
    apply_filters( 'weglot_replace_div_id', $dom );
  • src/services/class-replace-link-service-weglot.php line 59
    apply_filters( 'weglot_replace_url', $this->request_url_services->create_url_object($url)->getForLanguage($language, $evenExcluded), $url, $language );
  • src/services/class-generate-switcher-service-weglot.php line 60
    apply_filters( 'weglot_replace_weglot_menu', $dom );
  • src/services/class-request-url-service-weglot.php line 186
    apply_filters( 'weglot_server_host', $host );
  • src/third/stackable/class-stackable-active.php line 34
    apply_filters( 'weglot_stackable_is_active', $active );
  • src/actions/front/class-translate-page-weglot.php line 745
    apply_filters( 'weglot_switcher_sri_enabled', true, $handle );
  • templates/admin/pages/tabs/settings.php line 17
    apply_filters( 'weglot_tabs_admin_options_available', [ 'api_key_private' => [ 'key' => 'api_key_private', 'label' => __( 'API Key', 'weglot' ), 'description' => sprintf( esc_html__( 'Log in to %1$sWeglot%2$s to get your API key.', 'weglot' ), '<a target="_blank" href="' . $signup_link . '">', '</a>' ), ], 'language_from' => [ 'key' => 'original_language', 'label' => __( 'Original language', 'weglot' ), 'description' => 'What is the original (curr... );
  • src/third/theeventscalendar/class-theeventscalendar-active.php line 34
    apply_filters( 'weglot_theeventscalendar_is_active', $active );
  • src/third/woocommerce/class-wc-filter-urls-weglot.php line 254
    apply_filters( 'weglot_translate_block_cart_checkout', false );
  • src/actions/front/class-translate-page-weglot.php line 867
    apply_filters( 'weglot_translate_dynamics', false );
  • src/actions/class-email-translate-weglot.php line 80
    apply_filters( 'weglot_translate_email_languages_forced', false );
  • src/third/woocommercepdf/class-wcpdf-weglot.php line 67
    apply_filters( 'weglot_translate_pdf', false );
  • src/services/class-translate-service-weglot.php line 240
    do_action( 'weglot_treat_page_hook', $this->current_language );
  • src/services/class-translate-service-weglot.php line 192
    apply_filters( 'weglot_type_treat_page', $type );
  • src/third/underconstructionpage/class-ucp-active.php line 37
    apply_filters( 'weglot_ucp_is_active', $active );
  • src/services/class-request-url-service-weglot.php line 115
    apply_filters( 'weglot_url_object', $this->weglot_url );
  • src/actions/admin/class-metabox-url-translate-weglot.php line 53
    apply_filters( 'weglot_url_translate_metabox_post_type_exclude', array( 'attachment', 'shop_order', 'shop_coupon', ) );
  • src/services/class-request-url-service-weglot.php line 177
    apply_filters( 'weglot_use_forwarded_host', $use_forwarded_host );
  • src/services/class-version-service-weglot.php line 48
    apply_filters( 'weglot_v2_percentage_split', $percentage );
  • src/services/class-button-service-weglot.php line 152
    apply_filters( 'weglot_validate_button_option', true );
  • src/third/woocommerce/class-wc-cart-reload-weglot.php line 60
    apply_filters( 'weglot_wc_reload_selector', '.weglot-lang a' );
  • src/actions/front/class-translate-page-weglot.php line 962
    apply_filters( 'weglot_whitelist_selectors', $default_whitelist );
  • src/third/woocommerce/class-wc-mail-weglot.php line 50
    apply_filters( 'weglot_woocommerce_translate_following_mail', true );
  • src/services/class-regex-checkers-service-weglot.php line 38
    apply_filters( 'weglot_words_translate', array() );
  • src/third/wpoptimize/class-wp-optimize-active.php line 37
    apply_filters( 'weglot_wp_optimize_is_active', $active );
  • src/third/wpforms/class-wpforms-active.php line 34
    apply_filters( 'weglot_wpforms_is_active', $active );
  • src/third/wprentals/class-wprentals-active.php line 34
    apply_filters( 'weglot_wprentals_is_active', $active );
  • src/third/wprentals/class-wprentals-active.php line 51
    apply_filters( 'weglot_wprentals_is_theme_active', $active );
  • src/third/wprocket/class-wprocket-active.php line 34
    apply_filters( 'weglot_wprocket_is_active', $active );
  • src/services/class-translate-service-weglot.php line 265
    apply_filters( 'weglot_xml_treat_page', $translated_content );
  • weglot.php line 127
    apply_filters( 'weglot/skip_contexts', $contexts );
  • widget_title

    filter
    src/widgets/class-widget-selector-weglot.php line 42
    apply_filters( 'widget_title', $title );

Generated from Translate WordPress with Weglot 2.0's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: