Other Hooks

Auto-generated filters. Contains all the filter in Weglot's plugin code

Hook: weglot_translate_email

Description

File: src/actions/class-email-translate-weglot.php

Type: Filter

Parameter: $email_translate, $args

Declaration:

$translate_email = apply_filters( 'weglot_translate_email', $this->option_services->get_option( 'email_translate' ), $args );

Code exemple:

add_filter( 'weglot_translate_email', 'prefix_weglot_translate_email' );
function prefix_weglot_translate_email( $email_translate, $args ) { 
    // Code
    return $email_translate;
}

Hook: weglot_language_code_replace

Description

You can find the more documentation and example about this hook here : https://developers.weglot.com/wordpress/use-cases/use-custom-language-code-url-lang-and-hreflang-attribute

Type: Filter

Parameter: $replacements

Declaration:

$language_code_rewrited = apply_filters('weglot_language_code_replace' , array());

Code exemple:

add_filter( 'weglot_language_code_replace', 'prefix_weglot_weglot_language_code_replace' );
function prefix_weglot_weglot_language_code_replace( $replacements ) { 
    // Code
    return $replacements;
}

Hook: weglot_get_rest_current_url_path

Description

File: weglot-functions.php

Type: Filter

Parameter: $current_url

Declaration:

return apply_filters( 'weglot_get_rest_current_url_path', $current_url['path'] );

Code exemple:

add_filter( 'weglot_get_rest_current_url_path', 'prefix_weglot_get_rest_current_url_path' );
function prefix_weglot_get_rest_current_url_path( $current_url ) { 
    // Code
    return $current_url;
}

Hook: weglot_ninja_forms_is_active

Description

File: ./src/third/ninjaforms/class-ninja-active.php

Type: Filter

Parameter: $active

Declaration:

return apply_filters( 'weglot_ninja_forms_is_active', $active );

Code exemple:

add_filter( 'weglot_ninja_forms_is_active', 'prefix_weglot_ninja_forms_is_active' );
function prefix_weglot_ninja_forms_is_active( $active ) { 
    // Code
    return $active;
}

Hook: weglot_wc_reload_selector

Description

File: ./src/third/woocommerce/class-wc-cart-reload-weglot.php

Type: Filter

Parameter: $string

Declaration:

$click_selector = apply_filters( 'weglot_wc_reload_selector', '.weglot-lang a' );

Code exemple:

add_filter( 'weglot_wc_reload_selector', 'prefix_weglot_wc_reload_selector' );
function prefix_weglot_wc_reload_selector( $string ) { 
    // Code
    return $string;
}

Hook: weglot_caldera_forms_is_active

Description

File: ./src/third/calderaforms/class-caldera-active.php

Type: Filter

Parameter: $active

Declaration:

return apply_filters( 'weglot_caldera_forms_is_active', $active );

Code exemple:

add_filter( 'weglot_caldera_forms_is_active', 'prefix_weglot_caldera_forms_is_active' );
function prefix_weglot_caldera_forms_is_active( $active ) { 
    // Code
    return $active;
}

Hook: weglot_wpforms_is_active

Description

File: ./src/third/wpforms/class-wpforms-active.php

Type: Filter

Parameter: $active

Declaration:

return apply_filters( 'weglot_wpforms_is_active', $active );

Code exemple:

add_filter( 'weglot_wpforms_is_active', 'prefix_weglot_wpforms_is_active' );
function prefix_weglot_wpforms_is_active( $active ) { 
    // Code
    return $active;
}

Hook: weglot_regex_amp

Description

File: ./src/third/amp/class-amp-service-weglot.php

Type: Filter

Parameter: $regex

Declaration:

return apply_filters( 'weglot_regex_amp', $regex );

Code exemple:

add_filter( 'weglot_regex_amp', 'prefix_weglot_regex_amp' );
function prefix_weglot_regex_amp( $regex ) { 
    // Code
    return $regex;
}

Hook: weglot_another_redirect_override

Description

File: ./src/third/yoast/class-redirect-handler-weglot.php

Parameter: $request_url

Declaration:

do_action( 'weglot_another_redirect_override', $this->request_url );

Code exemple:

add_action( 'weglot_another_redirect_override', 'prefix_weglot_another_redirect_override' );
function prefix_weglot_another_redirect_override( $request_url ) { 
    // Code
}

Hook: weglot_ucp_is_active

Description

File: ./src/third/underconstructionpage/class-ucp-active.php

Type: Filter

Parameter: $active

Declaration:

return apply_filters( 'weglot_ucp_is_active', $active );

Code exemple:

add_filter( 'weglot_ucp_is_active', 'prefix_weglot_ucp_is_active' );
function prefix_weglot_ucp_is_active( $active ) { 
    // Code
    return $active;
}

Hook: weglot_menu_parent_menu_item_title

Description

File: ./src/actions/front/class-front-menu-weglot.php

Type: Filter

Parameter: $title

Declaration:

$item->title = apply_filters( 'weglot_menu_parent_menu_item_title', $title );

Code exemple:

add_filter( 'weglot_menu_parent_menu_item_title', 'prefix_weglot_menu_parent_menu_item_title' );
function prefix_weglot_menu_parent_menu_item_title( $title ) { 
    // Code
    return $title;
}

Hook: weglot_query_vars_check

Description

File: ./src/actions/front/class-search-weglot.php

Type: Filter

Parameter: $string

Declaration:

$query_vars_check = apply_filters( 'weglot_query_vars_check', 's' );

Code exemple:

add_filter( 'weglot_query_vars_check', 'prefix_weglot_query_vars_check' );
function prefix_weglot_query_vars_check( $string ) { 
    // Code
    return $string;
}

Hook: weglot_active_translation_before_process

Description

File: ./src/actions/front/class-translate-page-weglot.php

Type: Filter

Parameter: $bool

Declaration:

$active_translation = apply_filters( 'weglot_active_translation_before_process', true );

Code exemple:

add_filter( 'weglot_active_translation_before_process', 'prefix_weglot_active_translation_before_process' );
function prefix_weglot_active_translation_before_process( $bool ) { 
    // Code
    return $bool;
}

Hook: weglot_active_translation_before_treat_page

Description

File: ./src/actions/front/class-translate-page-weglot.php

Type: Filter

Parameter: $bool

Declaration:

$active_translation = apply_filters( 'weglot_active_translation_before_treat_page', true );

Code exemple:

add_filter( 'weglot_active_translation_before_treat_page', 'prefix_weglot_active_translation_before_treat_page' );
function prefix_weglot_active_translation_before_treat_page( $bool ) { 
    // Code
    return $bool;
}

Hook: weglot_debug_file

Description

File: ./src/actions/front/class-translate-page-weglot.php

Type: Filter

Parameter: $weglot_dir_string

Declaration:

$file = apply_filters( 'weglot_debug_file', WEGLOT_DIR . '/content.html' );

Code exemple:

add_filter( 'weglot_debug_file', 'prefix_weglot_debug_file' );
function prefix_weglot_debug_file( $weglot_dir_string ) { 
    // Code
    return $weglot_dir_string;
}

Hook: weglot_get_clean_base_url

Description

File: ./src/helpers/class-helper-filter-url-weglot.php

Type: Filter

Parameter: $url

Declaration:

return apply_filters( 'weglot_get_clean_base_url', $url );

Code exemple:

add_filter( 'weglot_get_clean_base_url', 'prefix_weglot_get_clean_base_url' );
function prefix_weglot_get_clean_base_url( $url ) { 
    // Code
    return $url;
}

Hook: weglot_helper_filter_url_lambda

Description

File: ./src/helpers/class-helper-filter-url-weglot.php

Type: Filter

Parameter: $prevent_subfolder_install

Declaration:

return apply_filters( 'weglot_helper_filter_url_lambda', self::prevent_subfolder_install( $url ) );

Code exemple:

add_filter( 'weglot_helper_filter_url_lambda', 'prefix_weglot_helper_filter_url_lambda' );
function prefix_weglot_helper_filter_url_lambda( $prevent_subfolder_install ) { 
    // Code
    return $prevent_subfolder_install;
}

Hook: weglot_helper_filter_url_without_ajax

Description

File: ./src/helpers/class-helper-filter-url-weglot.php

Type: Filter

Parameter: $prevent_subfolder_install

Declaration:

return apply_filters( 'weglot_helper_filter_url_without_ajax', self::prevent_subfolder_install( $url ) );

Code exemple:

add_filter( 'weglot_helper_filter_url_without_ajax', 'prefix_weglot_helper_filter_url_without_ajax' );
function prefix_weglot_helper_filter_url_without_ajax( $prevent_subfolder_install ) { 
    // Code
    return $prevent_subfolder_install;
}

Description

File: ./src/helpers/class-helper-replace-url-weglot.php

Type: Filter

Parameter: $data

Declaration:

return apply_filters( 'weglot_get_replace_modify_link', $data );

Code exemple:

add_filter( 'weglot_get_replace_modify_link', 'prefix_weglot_get_replace_modify_link' );
function prefix_weglot_get_replace_modify_link( $data ) { 
    // Code
    return $data;
}

Hook: weglot_get_flag_class

Description

File: ./src/services/class-button-service-weglot.php

Type: Filter

Parameter: $flag_class

Declaration:

return apply_filters( 'weglot_get_flag_class', $flag_class );

Code exemple:

add_filter( 'weglot_get_flag_class', 'prefix_weglot_get_flag_class' );
function prefix_weglot_get_flag_class( $flag_class ) { 
    // Code
    return $flag_class;
}

Hook: weglot_get_name_with_language_entry

Description

File: ./src/services/class-button-service-weglot.php

Type: Filter

Parameters: $name, $language_entry

Declaration:

return apply_filters( 'weglot_get_name_with_language_entry', $name, $language_entry );

Code exemple:

add_filter( 'weglot_get_name_with_language_entry', 'prefix_weglot_get_name_with_language_entry', 10, 2 );
function prefix_weglot_get_name_with_language_entry( $name, $language_entry ) { 
    // Code
    return $name;
}

Hook: weglot_get_class_dropdown

Description

File: ./src/services/class-button-service-weglot.php

Type: Filter

Parameter: $class

Declaration:

return apply_filters( 'weglot_get_class_dropdown', $class );

Code exemple:

add_filter( 'weglot_get_class_dropdown', 'prefix_weglot_get_class_dropdown' );
function prefix_weglot_get_class_dropdown( $class ) { 
    // Code
    return $class;
}

Hook: weglot_button_html

Description

File: ./src/services/class-button-service-weglot.php

Type: Filter

Parameters: $button_html, $add_class

Declaration:

return apply_filters( 'weglot_button_html', $button_html, $add_class );

Code exemple:

add_filter( 'weglot_button_html', 'prefix_weglot_button_html', 10, 2 );
function prefix_weglot_button_html( $button_html, $add_class ) { 
    // Code
    return $button_html;
}

Description

File: ./src/services/class-custom-url-service-weglot.php

Type: Filter

Parameters: $url_lang, $key_code

Declaration:

$link_button = apply_filters( 'weglot_link_language', $url_lang, $key_code );

Code exemple:

add_filter( 'weglot_link_language', 'prefix_weglot_link_language', 10, 2 );
function prefix_weglot_link_language( $url_lang, $key_code ) { 
    // Code
    return $url_lang;
}

Description

File: ./src/services/class-custom-url-service-weglot.php

Type: Filter

Parameter: $link_button

Declaration:

return apply_filters( 'weglot_get_link_with_key_code', $link_button );

Code exemple:

add_filter( 'weglot_get_link_with_key_code', 'prefix_weglot_get_link_with_key_code' );
function prefix_weglot_get_link_with_key_code( $link_button ) { 
    // Code
    return $link_button;
}

Description

File: ./src/services/class-custom-url-service-weglot.php

Type: Filter

Parameter: $link_button

Declaration:

return apply_filters( 'weglot_get_link_button_with_key_code', $link_button );

Code exemple:

add_filter( 'weglot_get_link_button_with_key_code', 'prefix_weglot_get_link_button_with_key_code' );
function prefix_weglot_get_link_button_with_key_code( $link_button ) { 
    // Code
    return $link_button;
}

Hook: weglot_get_dom_checkers

Description

File: ./src/services/class-dom-checkers-service-weglot.php

Type: Filter

Parameter: $checkers

Declaration:

return apply_filters( 'weglot_get_dom_checkers', $checkers );

Code exemple:

add_filter( 'weglot_get_dom_checkers', 'prefix_weglot_get_dom_checkers' );
function prefix_weglot_get_dom_checkers( $checkers ) { 
    // Code
    return $checkers;
}

Hook: weglot_get_dom_listeners

Description

File: ./src/services/class-dom-listeners-service-weglot.php

Type: Filter

Parameter: $dom_listeners

Declaration:

return apply_filters( 'weglot_get_dom_listeners', $this->dom_listeners );

Code exemple:

add_filter( 'weglot_get_dom_listeners', 'prefix_weglot_get_dom_listeners' );
function prefix_weglot_get_dom_listeners( $dom_listeners ) { 
    // Code
    return $dom_listeners;
}

Hook: weglot_replace_div_id

Description

File: ./src/services/class-generate-switcher-service-weglot.php

Type: Filter

Parameter: $dom

Declaration:

return apply_filters( 'weglot_replace_div_id', $dom );

Code exemple:

add_filter( 'weglot_replace_div_id', 'prefix_weglot_replace_div_id' );
function prefix_weglot_replace_div_id( $dom ) { 
    // Code
    return $dom;
}

Hook: weglot_replace_weglot_menu

Description

File: ./src/services/class-generate-switcher-service-weglot.php

Type: Filter

Parameter: $dom

Declaration:

return apply_filters( 'weglot_replace_weglot_menu', $dom );

Code exemple:

add_filter( 'weglot_replace_weglot_menu', 'prefix_weglot_replace_weglot_menu' );
function prefix_weglot_replace_weglot_menu( $dom ) { 
    // Code
    return $dom;
}

Hook: weglot_render_default_button

Description

File: ./src/services/class-generate-switcher-service-weglot.php

Type: Filter

Parameter: $dom

Declaration:

return apply_filters( 'weglot_render_default_button', $dom );

Code exemple:

add_filter( 'weglot_render_default_button', 'prefix_weglot_render_default_button' );
function prefix_weglot_render_default_button( $dom ) { 
    // Code
    return $dom;
}

Hook: weglot_generate_switcher_from_dom

Description

File: ./src/services/class-generate-switcher-service-weglot.php

Type: Filter

Parameter: $dom

Declaration:

return apply_filters( 'weglot_generate_switcher_from_dom', $dom );

Code exemple:

add_filter( 'weglot_generate_switcher_from_dom', 'prefix_weglot_generate_switcher_from_dom' );
function prefix_weglot_generate_switcher_from_dom( $dom ) { 
    // Code
    return $dom;
}

Hook: weglot_href_lang

Description

File: ./src/services/class-href-lang-service-weglot.php

Type: Filter

Parameter: $render

Declaration:

return apply_filters( 'weglot_href_lang', $render );

Code exemple:

add_filter( 'weglot_href_lang', 'prefix_weglot_href_lang' );
function prefix_weglot_href_lang( $render ) { 
    // Code
    return $render;
}

Hook: weglot_current_language_entry

Description

File: ./src/services/class-language-service-weglot.php

Type: Filter

Parameter: $key_code

Declaration:

$current_language_entry = apply_filters( 'weglot_current_language_entry', $key_code );

Code exemple:

add_filter( 'weglot_current_language_entry', 'prefix_weglot_current_language_entry' );
function prefix_weglot_current_language_entry( $key_code ) { 
    // Code
    return $key_code;
}

Hook: weglot_get_options_from_cdn_cache

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $bool

Declaration:

$cache_transient = apply_filters( 'weglot_get_options_from_cdn_cache', true );

Code exemple:

add_filter( 'weglot_get_options_from_cdn_cache', 'prefix_weglot_get_options_from_cdn_cache' );
function prefix_weglot_get_options_from_cdn_cache( $bool ) { 
    // Code
    return $bool;
}

Hook: weglot_get_options_from_cdn_cache_duration

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $300

Declaration:

set_transient( 'weglot_cache_cdn', $body, apply_filters( 'weglot_get_options_from_cdn_cache_duration', 300 ) );

Code exemple:

add_filter( 'weglot_get_options_from_cdn_cache_duration', 'prefix_weglot_get_options_from_cdn_cache_duration' );
function prefix_weglot_get_options_from_cdn_cache_duration( $300 ) { 
    // Code
    return $300;
}

Hook: weglot_get_options

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameters: $array_merge, $body

Declaration:

$options = apply_filters( 'weglot_get_options', array_merge( $this->get_options_bdd_v3(), $body ) );

Code exemple:

add_filter( 'weglot_get_options', 'prefix_weglot_get_options', 10, 2 );
function prefix_weglot_get_options( $array_merge, $body ) { 
    // Code
    return $array_merge;
}

Hook: weglot_get_api_key

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $api_key

Declaration:

return apply_filters( 'weglot_get_api_key', $api_key );

Code exemple:

add_filter( 'weglot_get_api_key', 'prefix_weglot_get_api_key' );
function prefix_weglot_get_api_key( $api_key ) { 
    // Code
    return $api_key;
}

Hook: weglot_get_api_key

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $options

Declaration:

return apply_filters( 'weglot_get_api_key', $options['api_key'] );

Code exemple:

add_filter( 'weglot_get_api_key', 'prefix_weglot_get_api_key' );
function prefix_weglot_get_api_key( $options ) { 
    // Code
    return $options;
}

Hook: weglot_get_options

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameters: $array_merge, $options

Declaration:

$options = apply_filters( 'weglot_get_options', array_merge( $this->options_bdd_default, $this->get_options_bdd_v3(), $options ) );

Code exemple:

add_filter( 'weglot_get_options', 'prefix_weglot_get_options', 10, 2 );
function prefix_weglot_get_options( $array_merge, $options ) { 
    // Code
    return $array_merge;
}

Hook: weglot_exclude_blocks

Description

Permet de modifier l'array des exclusions par défault. Par exemple si on veut enlever de la liste des exclusions un élement on peut utiliser ce filtre. (Voir exemple ci dessous)

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $exclude_blocks

Declaration:

return apply_filters( 'weglot_exclude_blocks', $exclude_blocks );

Code exemple:

// Ce code permet d'enlever .amount de l'exclusion
add_filter( 'weglot_exclude_blocks', 'prefix_weglot_exclude_blocks' );
function prefix_weglot_exclude_blocks( $exclude_blocks ) { 
		unset($exclude_blocks[array_search(".amount", $exclude_blocks)]);
		return $exclude_blocks;
}

Hook: weglot_destination_languages

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $destination_languages

Declaration:

return apply_filters( 'weglot_destination_languages', $destination_languages );

Code exemple:

add_filter( 'weglot_destination_languages', 'prefix_weglot_destination_languages' );
function prefix_weglot_destination_languages( $destination_languages ) { 
    // Code
    return $destination_languages;
}

Hook: weglot_css_custom_inline

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $get_option

Declaration:

return apply_filters( 'weglot_css_custom_inline', $this->get_option( 'override_css' ) );

Code exemple:

add_filter( 'weglot_css_custom_inline', 'prefix_weglot_css_custom_inline' );
function prefix_weglot_css_custom_inline( $get_option ) { 
    // Code
    return $get_option;
}

Hook: weglot_flag_css

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $get_option

Declaration:

return apply_filters( 'weglot_flag_css', $this->get_option( 'flag_css' ) );

Code exemple:

add_filter( 'weglot_flag_css', 'prefix_weglot_flag_css' );
function prefix_weglot_flag_css( $get_option ) { 
    // Code
    return $get_option;
}

Hook: weglot_get_translation_engine

Description

File: ./src/services/class-option-service-weglot.php

Type: Filter

Parameter: $get_option

Declaration:

return apply_filters( 'weglot_get_translation_engine', $this->get_option( 'translation_engine' ) );

Code exemple:

add_filter( 'weglot_get_translation_engine', 'prefix_weglot_get_translation_engine' );
function prefix_weglot_get_translation_engine( $get_option ) { 
    // Code
    return $get_option;
}

Hook: weglot_parser_config_provider

Description

File: ./src/services/class-parser-service-weglot.php

Type: Filter

Parameter: $serverconfigprovider

Declaration:

$config = apply_filters( 'weglot_parser_config_provider', new ServerConfigProvider() );

Code exemple:

add_filter( 'weglot_parser_config_provider', 'prefix_weglot_parser_config_provider' );
function prefix_weglot_parser_config_provider( $serverconfigprovider ) { 
    // Code
    return $serverconfigprovider;
}

Hook: weglot_get_parser_ignored_nodes

Description

File: ./src/services/class-parser-service-weglot.php

Type: Filter

Parameter: $parser_getignorednodesformatter_getignorednodes

Declaration:

$ignored_nodes = apply_filters( 'weglot_get_parser_ignored_nodes', $parser->getIgnoredNodesFormatter()->getIgnoredNodes() );

Code exemple:

add_filter( 'weglot_get_parser_ignored_nodes', 'prefix_weglot_get_parser_ignored_nodes' );
function prefix_weglot_get_parser_ignored_nodes( $parser_getignorednodesformatter_getignorednodes ) { 
    // Code
    return $parser_getignorednodesformatter_getignorednodes;
}

Hook: weglot_redirection_language_exception

Description

File: ./src/services/class-redirect-service-weglot.php

Type: Filter

Parameter: $server_lang

Declaration:

return apply_filters( 'weglot_redirection_language_exception', $server_lang );

Code exemple:

add_filter( 'weglot_redirection_language_exception', 'prefix_weglot_redirection_language_exception' );
function prefix_weglot_redirection_language_exception( $server_lang ) { 
    // Code
    return $server_lang;
}

Hook: weglot_url_auto_redirect

Description

File: ./src/services/class-redirect-service-weglot.php

Type: Filter

Parameter: $request_url_services_get_weglot_url_getforlanguage

Declaration:

$url_auto_redirect = apply_filters( 'weglot_url_auto_redirect', $this->request_url_services->get_weglot_url()->getForLanguage( $server_lang ) );

Code exemple:

add_filter( 'weglot_url_auto_redirect', 'prefix_weglot_url_auto_redirect' );
function prefix_weglot_url_auto_redirect( $request_url_services_get_weglot_url_getforlanguage ) { 
    // Code
    return $request_url_services_get_weglot_url_getforlanguage;
}

Hook: weglot_url_auto_redirect

Description

File: ./src/services/class-redirect-service-weglot.php

Type: Filter

Parameter: $request_url_services_get_weglot_url_getforlanguage

Declaration:

$url_auto_redirect = apply_filters( 'weglot_url_auto_redirect', $this->request_url_services->get_weglot_url()->getForLanguage( $this->option_services->get_option('autoswitch_fallback') ) );

Code exemple:

add_filter( 'weglot_url_auto_redirect', 'prefix_weglot_url_auto_redirect' );
function prefix_weglot_url_auto_redirect( $request_url_services_get_weglot_url_getforlanguage ) { 
    // Code
    return $request_url_services_get_weglot_url_getforlanguage;
}

Hook: weglot_words_translate

Description

File: ./src/services/class-regex-checkers-service-weglot.php

Type: Filter

Parameter: $int

Declaration:

$other_words = apply_filters( 'weglot_words_translate', [] );

Code exemple:

add_filter( 'weglot_words_translate', 'prefix_weglot_words_translate' );
function prefix_weglot_words_translate( $int ) { 
    // Code
    return $int;
}

Hook: weglot_get_regex_checkers

Description

File: ./src/services/class-regex-checkers-service-weglot.php

Type: Filter

Parameter: $checkers

Declaration:

return apply_filters( 'weglot_get_regex_checkers', $checkers );

Code exemple:

add_filter( 'weglot_get_regex_checkers', 'prefix_weglot_get_regex_checkers' );
function prefix_weglot_get_regex_checkers( $checkers ) { 
    // Code
    return $checkers;
}

Hook: weglot_no_replace_url_condition

Description

File: ./src/services/class-replace-link-service-weglot.php

Type: Filter

Parameter: $string

Declaration:

$no_replace_condition = apply_filters( 'weglot_no_replace_url_condition', 'wp-content/uploads' );

Code exemple:

add_filter( 'weglot_no_replace_url_condition', 'prefix_weglot_no_replace_url_condition' );
function prefix_weglot_no_replace_url_condition( $string ) { 
    // Code
    return $string;
}

Hook: weglot_no_replace_a_href

Description

File: ./src/services/class-replace-link-service-weglot.php

Type: Filter

Parameter: $string

Declaration:

$no_replace_condition = apply_filters( 'weglot_no_replace_a_href', 'wp-content/uploads' );

Code exemple:

add_filter( 'weglot_no_replace_a_href', 'prefix_weglot_no_replace_a_href' );
function prefix_weglot_no_replace_a_href( $string ) { 
    // Code
    return $string;
}

Description

File: ./src/services/class-replace-url-service-weglot.php

Type: Filter

Parameter: $dom

Declaration:

return apply_filters( 'weglot_replace_link', $dom );

Code exemple:

add_filter( 'weglot_replace_link', 'prefix_weglot_replace_link' );
function prefix_weglot_replace_link( $dom ) { 
    // Code
    return $dom;
}

Hook: weglot_ajax_replace_urls

Description

File: ./src/services/class-replace-url-service-weglot.php

Type: Filter

Parameter: $int

Declaration:

$replace_urls = apply_filters( 'weglot_ajax_replace_urls', [ 'redirecturl', 'url', 'link' ] );

Code exemple:

add_filter( 'weglot_ajax_replace_urls', 'prefix_weglot_ajax_replace_urls' );
function prefix_weglot_ajax_replace_urls( $int ) { 
    // Code
    return $int;
}

Hook: weglot_length_replace_a

Description

File: ./src/services/class-replace-url-service-weglot.php

Type: Filter

Parameter: $int

Declaration:

$length_link = apply_filters( 'weglot_length_replace_a', 1500 );

Code exemple:

add_filter( 'weglot_length_replace_a', 'prefix_weglot_length_replace_a' );
function prefix_weglot_length_replace_a( $int ) { 
    // Code
    return $int;
}

Description

File: ./src/services/class-replace-url-service-weglot.php

Type: Filter

Parameters: $string_type, $type

Declaration:

$function_name = apply_filters( 'weglot_modify_link_replace_function', 'replace_' . $type, $type );

Code exemple:

add_filter( 'weglot_modify_link_replace_function', 'prefix_weglot_modify_link_replace_function', 10, 2 );
function prefix_weglot_modify_link_replace_function( $string_type, $type ) { 
    // Code
    return $string_type;
}

Description

File: ./src/services/class-replace-url-service-weglot.php

Type: Filter

Parameter: $server

Declaration:

$server_host = apply_filters( 'weglot_check_link_server_host', $_SERVER['HTTP_HOST'] );

Code exemple:

add_filter( 'weglot_check_link_server_host', 'prefix_weglot_check_link_server_host' );
function prefix_weglot_check_link_server_host( $server ) { 
    // Code
    return $server;
}

Hook: weglot_default_current_language_empty

Description

File: ./src/services/class-request-url-service-weglot.php

Type: Filter

Parameter: $string

Declaration:

return apply_filters( 'weglot_default_current_language_empty', 'en' );

Code exemple:

add_filter( 'weglot_default_current_language_empty', 'prefix_weglot_default_current_language_empty' );
function prefix_weglot_default_current_language_empty( $string ) { 
    // Code
    return $string;
}

Hook: weglot_translate_current_language

Description

File: ./src/services/class-request-url-service-weglot.php

Type: Filter

Parameter: $current_language

Declaration:

return apply_filters( 'weglot_translate_current_language', $current_language );

Code exemple:

add_filter( 'weglot_translate_current_language', 'prefix_weglot_translate_current_language' );
function prefix_weglot_translate_current_language( $current_language ) { 
    // Code
    return $current_language;
}

Hook: weglot_is_eligible_url

Description

File: ./src/services/class-request-url-service-weglot.php

Type: Filter

Parameters: $bool, $weglot_url

Declaration:

return apply_filters( 'weglot_is_eligible_url', false, $weglot_url );

Code exemple:

add_filter( 'weglot_is_eligible_url', 'prefix_weglot_is_eligible_url', 10, 2 );
function prefix_weglot_is_eligible_url( $bool, $weglot_url ) { 
    // Code
    return $bool;
}

Hook: weglot_is_eligible_url

Description

File: ./src/services/class-request-url-service-weglot.php

Type: Filter

Parameters: $bool, $weglot_url

Declaration:

return apply_filters( 'weglot_is_eligible_url', false, $weglot_url );

Code exemple:

add_filter( 'weglot_is_eligible_url', 'prefix_weglot_is_eligible_url', 10, 2 );
function prefix_weglot_is_eligible_url( $bool, $weglot_url ) { 
    // Code
    return $bool;
}

Hook: weglot_is_eligible_url

Description

File: ./src/services/class-request-url-service-weglot.php

Type: Filter

Parameters: $bool, $url

Declaration:

return apply_filters( 'weglot_is_eligible_url', true, $url );

Code exemple:

add_filter( 'weglot_is_eligible_url', 'prefix_weglot_is_eligible_url', 10, 2 );
function prefix_weglot_is_eligible_url( $bool, $url ) { 
    // Code
    return $bool;
}

Hook: weglot_type_treat_page

Description

File: ./src/services/class-translate-service-weglot.php

Type: Filter

Parameter: $type

Declaration:

$type = apply_filters( 'weglot_type_treat_page', $type );

Code exemple:

add_filter( 'weglot_type_treat_page', 'prefix_weglot_type_treat_page' );
function prefix_weglot_type_treat_page( $type ) { 
    // Code
    return $type;
}

Hook: weglot_active_translation

Description

File: ./src/services/class-translate-service-weglot.php

Type: Filter

Parameter: $bool

Declaration:

$active_translation = apply_filters( 'weglot_active_translation', true );

Code exemple:

add_filter( 'weglot_active_translation', 'prefix_weglot_active_translation' );
function prefix_weglot_active_translation( $bool ) { 
    // Code
    return $bool;
}

Hook: weglot_add_json_keys

Description

File: ./src/services/class-translate-service-weglot.php

Type: Filter

Parameter: $array

Declaration:

$extraKeys = apply_filters( 'weglot_add_json_keys' , array() );

Code exemple:

add_filter( 'weglot_add_json_keys', 'prefix_weglot_add_json_keys' );
function prefix_weglot_add_json_keys( $array ) { 
    // Code
    return $array;
}

Hook: weglot_json_treat_page

Description

File: ./src/services/class-translate-service-weglot.php

Type: Filter

Parameter: $translated_content

Declaration:

$translated_content = apply_filters( 'weglot_json_treat_page', $translated_content );

Code exemple:

add_filter( 'weglot_json_treat_page', 'prefix_weglot_json_treat_page' );
function prefix_weglot_json_treat_page( $translated_content ) { 
    // Code
    return $translated_content;
}

Hook: weglot_html_treat_page

Description

File: ./src/services/class-translate-service-weglot.php

Type: Filter

Parameter: $translated_content

Declaration:

$translated_content = apply_filters( 'weglot_html_treat_page', $translated_content );

Code exemple:

add_filter( 'weglot_html_treat_page', 'prefix_weglot_html_treat_page' );
function prefix_weglot_html_treat_page( $translated_content ) { 
    // Code
    return $translated_content;
}

Hook: weglot_render_dom

Description

File: ./src/services/class-translate-service-weglot.php

Type: Filter

Parameter: $dom

Declaration:

return apply_filters( 'weglot_render_dom', $dom );

Code exemple:

add_filter( 'weglot_render_dom', 'prefix_weglot_render_dom' );
function prefix_weglot_render_dom( $dom ) { 
    // Code
    return $dom;
}

Hook: weglot_remove_google_translate

Description

By default, Weglot plugin adds a meta tag on all translated pages: <meta name="google" content="notranslate" /> This is to prevent Google Chrome from showing google translate on translated pages. Use this filter if you want to remove this tag and still allow Google translate on translated pages.

File: ./src/actions/front/class-translate-page-weglot.php

Type: Filter

Parameter: none

Declaration:

return apply_filters( 'weglot_remove_google_translate', true );

Code exemple:

add_filter( 'weglot_remove_google_translate', 'prefix_weglot_remove_google_translate' );
function prefix_weglot_remove_google_translate() { 
    return false;
}

Hook: weglot_render_dom

Description

File: ./src/services/class-translate-service-weglot.php

Type: Filter

Parameter: $dom

Declaration:

return apply_filters( 'weglot_render_dom', $dom );

Code exemple:

add_filter( 'weglot_render_dom', 'prefix_weglot_render_dom' );
function prefix_weglot_render_dom( $dom ) { 
    // Code
    return $dom;
}

Last updated