Polylang icon
Multilingual & Translation

Polylang hooks reference

  • By Chouby
  • v3.9.2 New
  • Updated

Polylang 3.9.2 has 30 actions and 91 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 Polylang fires an action
add_action( 'pll_language_defined', function( $slug, $curlang ) {
	// Your code runs here.
}, 10, 2 );

// Change a value Polylang is about to use
add_filter( 'pll_get_post_types', function( $public_post_types, $arg2 ) {
	// Change $public_post_types here.
	return $public_post_types;
}, 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/settings/settings-cpt.php line 66 · used in 3 places
    /**
     * This filter is documented in src/model.php
     */
    apply_filters( 'pll_get_post_types', $public_post_types, true );
  • src/settings/settings-cpt.php line 75 · used in 3 places
    /**
     * This filter is documented in src/model.php
     */
    apply_filters( 'pll_get_taxonomies', $public_taxonomies, true );
  • src/frontend/frontend-links.php line 129 · used in 3 places
    /**
     * Filter whether to hide an archive translation url
     */
    apply_filters( 'pll_hide_archive_translation_url', ! $count, $language->slug, array( 'taxonomy' => $term->taxonomy ) );
  • src/admin/admin-base.php line 439 · used in 3 places
    /**
     * This action is documented in src/frontend/choose-lang.php
     */
    do_action( 'pll_language_defined', $this->curlang->slug, $this->curlang );
  • src/admin/admin-base.php line 442 · used in 3 places
    /**
     * This action is documented in src/class-polylang.php
     */
    do_action( 'pll_no_language_defined' );
  • get_calendar

    filter
    src/Widgets/Calendar.php line 141 · used in 2 places
    /**
     * This filter is documented in wp-includes/general-template.php
     */
    apply_filters( 'get_calendar', $cache[ $key ], $args );
  • src/modules/sync/sync-post-metas.php line 78 · used in 2 places
    /**
     * This filter is documented in src/modules/sync/sync-metas.php
     */
    apply_filters( 'pll_copy_post_metas', $keys, $sync, $from, $to, $lang );
  • src/frontend/choose-lang-domain.php line 43 · used in 2 places
    /**
     * This action is documented in src/frontend/choose-lang.php
     */
    do_action( 'pll_home_requested' );
  • src/links-directory.php line 216 · used in 2 places
    /**
     * Filters the rewrite rules to modify.
     */
    apply_filters( 'pll_modify_rewrite_rule', true, array( $key => $rule ), $filter, false );
  • widget_title

    filter
    src/Widgets/Calendar.php line 39 · used in 2 places
    /**
     * This filter is documented in wp-includes/widgets/class-wp-widget-pages.php
     */
    apply_filters( 'widget_title', $title, $instance, $this->id_base );
  • change_locale

    action
    src/olt-manager.php line 86
    /**
     * This action is documented in wp-includes/class-wp-locale-switcher.php
     */
    do_action( 'change_locale', $new_locale );
  • src/language-deprecated.php line 241
    /**
     * Filters whether to trigger an error for deprecated properties.
     */
    apply_filters( 'deprecated_property_trigger_error', true );
  • src/install/plugin-updater.php line 615
    /**
     * Filters the parameters sent in the API request.
     */
    apply_filters( 'edd_sl_plugin_updater_api_params', $api_params, $this->api_data, $this->plugin_file );
  • src/Widgets/Calendar.php line 100
    /**
     * This filter is documented in wp-includes/general-template.php
     */
    apply_filters( 'get_calendar_args', wp_parse_args( $args, $defaults ) );
  • src/model.php line 499
    /**
     * Filters the max number of IDs to return when searching objects with no
     * language. This filter can be used to decrease the memory usage in case the
     * number of objects without language is too big. Using a negative value is
     * equivalent to have no limit.
     */
    apply_filters( 'get_objects_with_no_lang_limit', $limit, $types );
  • src/settings/settings.php line 252
    /**
     * Fires when a non default action has been sent to Polylang settings
     */
    do_action( "mlang_action_{$action}" );
  • src/Switcher/Layout/Abstract_Layout.php line 153
    /**
     * This filter is documented in
     * wp-includes/widgets/class-wp-nav-menu-widget.php
     */
    apply_filters( 'navigation_widgets_format', $format );
  • src/admin/admin-classic-editor.php line 258
    /**
     * This filter is documented in wp-admin/includes/meta-boxes.php
     */
    apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
  • pll_{$obj}

    filter
    src/admin/admin.php line 152
    /**
     * Filter the class to instantiate when loading admin filters
     */
    apply_filters( "pll_{$obj}", 'PLL_Admin_' . $class );
  • src/Model/Languages.php line 276
    /**
     * Fires after a language is added.
     */
    do_action( 'pll_add_language', $args );
  • src/language-factory.php line 135
    /**
     * Filters additional data to add to the language before it is created.
     */
    apply_filters( 'pll_additional_language_data', $additional_data, $data );
  • src/admin/admin-base.php line 386
    /**
     * Filters the list of parameters to add to the admin ajax request.
     */
    apply_filters( 'pll_admin_ajax_params', $params );
  • src/admin/admin-base.php line 434
    /**
     * Filters the current language used by Polylang in the admin context.
     */
    apply_filters( 'pll_admin_current_language', $this->curlang, $this );
  • src/admin/admin-base.php line 543
    /**
     * Filters the admin bar language filter submenu items.
     */
    apply_filters( 'pll_admin_languages_filter', $items, $all_items );
  • src/admin/admin-base.php line 479
    /**
     * Filters the preferred language on admin side. The preferred language is used
     * for example to determine the language of a new post.
     */
    apply_filters( 'pll_admin_preferred_language', $this->pref_lang );
  • src/Model/Languages.php line 668
    /**
     * Filters the list of languages *after* it is stored in the persistent cache.
     * /!\ This filter is fired *before* the $polylang object is available.
     */
    apply_filters_deprecated( 'pll_after_languages_cache', array( $languages ), '3.4' );
  • src/translated-post.php line 418
    /**
     * Filters the query args when auto suggesting untranslated posts in the
     * Languages metabox.
     */
    apply_filters( 'pll_ajax_posts_not_translated_args', $args );
  • src/admin/view-translations-post.php line 57
    /**
     * Fires before the translation column is outputted in the language metabox.
     * The dynamic portion of the hook name, `$lang`, refers to the language code.
     */
    do_action( "pll_before_post_translation_{$language->slug}", $post->post_type );
  • src/admin/admin-classic-editor.php line 149
    /**
     * Fires before displaying the list of translations in the Languages metabox
     * for posts.
     */
    do_action( 'pll_before_post_translations', $post_type );
  • src/admin/admin-notices.php line 131
    /**
     * Filters admin notices which can be displayed.
     */
    apply_filters( 'pll_can_display_notice', in_array( $screen->id, $allowed_screens, true ), $notice );
  • src/frontend/canonical.php line 146
    /**
     * Filters the canonical url detected by Polylang.
     */
    apply_filters( 'pll_check_canonical_url', $redirect_url, $language );
  • pll_context

    filter
    src/class-polylang.php line 220
    /**
     * Filters the class to use to instantiate the $polylang object
     */
    apply_filters( 'pll_context', $class );
  • src/modules/sync/sync-metas.php line 142
    /**
     * Filters the custom fields to copy or synchronize.
     */
    apply_filters( "pll_copy_{$this->meta_type}_metas", array(), $sync, $from, $to, $lang );
  • src/modules/sync/sync-tax.php line 73
    /**
     * Filters the taxonomies to copy or synchronize.
     */
    apply_filters( 'pll_copy_taxonomies', $taxonomies, $sync, $from, $to, $lang );
  • src/language-factory.php line 294
    /**
     * Filters the custom flag information.
     */
    apply_filters( 'pll_custom_flag', empty( $flags['custom_flag'] ) ? null : $flags['custom_flag'], $flag_code );
  • src/settings/table-languages.php line 131
    /**
     * Filters the default language row action in the languages list table.
     */
    apply_filters( 'pll_default_lang_row_action', $s, $item );
  • src/filter-rest-routes.php line 135
    /**
     * Filters REST routes filterable by languages.
     */
    apply_filters( 'pll_filtered_rest_routes', array_merge( $filtered_entities, array( 'search' => 'wp/v2/search' ) ) );
  • src/Model/Taxonomies.php line 97
    /**
     * Filters the list of taxonomies not translatable but filtered by language.
     * Includes only the post format by default The filter must be added soon in
     * the WordPress loading process: in a function hooked to ‘plugins_loaded’
     * or directly in functions.php for themes.
     */
    apply_filters( 'pll_filtered_taxonomies', $taxonomies, false );
  • src/admin/admin-filters-columns.php line 328
    /**
     * Filters the output of the first language column in the terms list table.
     */
    apply_filters( 'pll_first_language_term_column', $out, $term->term_id, $lang->slug );
  • pll_flag

    filter
    src/language.php line 447
    /**
     * Filters flag information:
     */
    apply_filters( 'pll_flag', $default_flag, $code );
  • src/frontend/frontend-links.php line 210
    /**
     * Filter the archive url
     */
    apply_filters( 'pll_get_archive_url', $url, $language );
  • src/frontend/choose-lang.php line 112
    /**
     * Filters the language before it is set.
     */
    apply_filters( 'pll_get_current_language', $curlang ?? false );
  • pll_get_flag

    filter
    src/language-factory.php line 335
    /**
     * Filters the html markup of a flag.
     */
    apply_filters( 'pll_get_flag', PLL_Language::get_flag_html( $flag, $name ), $slug );
  • src/admin/admin-links.php line 121
    /**
     * Filters the new post translation link.
     */
    apply_filters( 'pll_get_new_post_translation_link', $link, $language, $post->ID );
  • src/model.php line 531
    /**
     * Filters the list of IDs of untranslated objects.
     */
    apply_filters( 'pll_get_objects_with_no_lang', $objects, $limit, $types );
  • src/admin/admin-strings.php line 120
    /**
     * Filter the list of strings registered for translation Mainly for use by our
     * PLL_WPML_Compat class
     */
    apply_filters( 'pll_get_strings', self::$strings );
  • src/frontend/frontend-filters-links.php line 316
    /**
     * Filters the black list of the Polylang 'home_url' filter.
     */
    apply_filters( 'pll_home_url_black_list', $black_list );
  • src/frontend/frontend-filters-links.php line 297
    /**
     * Filters the white list of the Polylang 'home_url' filter.
     */
    apply_filters( 'pll_home_url_white_list', $white_list );
  • pll_init

    action
    src/class-polylang.php line 289
    /**
     * Fires after the $polylang object and the API is loaded
     */
    do_action_ref_array( 'pll_init', array( &$polylang ) );
  • src/Options/Options.php line 705
    /**
     * Fires after the options have been init for the current blog. This is the
     * best place to register options.
     */
    do_action( 'pll_init_options_for_blog', $this, $this->current_blog_id, $this->is_plugin_active() );
  • src/term-slug.php line 84
    /**
     * Filters the subsequently inserted term language.
     */
    apply_filters( 'pll_inserted_term_language', null, $this->taxonomy, $this->slug );
  • src/term-slug.php line 101
    /**
     * Filters the subsequently inserted term parent.
     */
    apply_filters( 'pll_inserted_term_parent', 0, $this->taxonomy, $this->slug );
  • src/class-polylang.php line 79
    /**
     * Filters whether the current request is an ajax request on front.
     */
    apply_filters( 'pll_is_ajax_on_front', $is_ajax_on_front );
  • src/functions.php line 25
    /**
     * Filters whether we should load the cache compatibility
     */
    apply_filters( 'pll_is_cache_active', ( defined( 'WP_CACHE' ) && WP_CACHE ) || defined( 'WPFC_MAIN_PATH' ) );
  • src/settings/view-tab-lang.php line 175
    /**
     * Fires after the Add Language form fields are displayed.
     */
    do_action( 'pll_language_add_form_fields' );
  • src/settings/view-tab-lang.php line 168
    /**
     * Fires after the Edit Language form fields are displayed.
     */
    do_action( 'pll_language_edit_form_fields', $edit_lang );
  • src/language.php line 579
    /**
     * Filters `flag_url` property.
     */
    apply_filters( 'pll_language_flag_url', $flag_url, $this );
  • src/language.php line 664
    /**
     * Filters current `PLL_Language` instance `home_url` property.
     */
    apply_filters( 'pll_language_home_url', $this->home_url, $this->to_array( 'db' ) );
  • src/Model/Languages.php line 1024
    /**
     * Allow to add data to store for a language. `$locale`, `$rtl`, and
     * `$flag_code` cannot be overwritten.
     */
    apply_filters( 'pll_language_metas', array(), $args, $new_data, $old_data );
  • src/language.php line 687
    /**
     * Filters current `PLL_Language` instance `search_url` property.
     */
    apply_filters( 'pll_language_search_url', $this->search_url, $this->to_array( 'db' ) );
  • src/Switcher/Switcher.php line 97
    /**
     * Filter the whole switcher markup.
     */
    apply_filters( 'pll_language_switcher_output', $html, $this->settings, $this );
  • src/Switcher/Settings/Settings.php line 162
    /**
     * Filter the language switcher settings.
     */
    apply_filters( 'pll_language_switcher_settings', $settings );
  • src/frontend/choose-lang.php line 190
    /**
     * Filters the list of languages to use to match the browser preferences.
     */
    apply_filters( 'pll_languages_for_browser_preferences', $languages );
  • src/Model/Languages.php line 1345
    /**
     * Filters the list of languages *before* it is stored in the persistent cache.
     * /!\ This filter is fired *before* the $polylang object is available.
     */
    apply_filters_deprecated( 'pll_languages_list', array( $languages, $this ), '3.4', 'pll_additional_language_data' );
  • src/settings/table-languages.php line 229
    /**
     * Filters the list of row actions in the languages list table.
     */
    apply_filters( 'pll_languages_row_actions', $actions, $item );
  • src/settings/table-languages.php line 49
    /**
     * Filter the list of classes assigned a row in the languages list table
     */
    apply_filters( 'pll_languages_row_classes', array(), $item );
  • src/modules/sync/sync-tax.php line 108
    /**
     * Filter the translated term when a post translation is created or
     * synchronized
     */
    apply_filters( 'pll_maybe_translate_term', (int) $this->model->term->get_translation( $term, $lang ), $term, $lang );
  • pll_model

    filter
    src/class-polylang.php line 187
    /**
     * Filter the model class to use /!\ this filter is fired *before* the
     * $polylang object is available
     */
    apply_filters( 'pll_model', PLL_SETTINGS || self::is_wizard() ? 'PLL_Admin_Model' : 'PLL_Model' );
  • src/class-polylang.php line 257
    /**
     * Fires after Polylang's model init. This is the best place to register a
     * custom table (see `PLL_Model`'s constructor). /!\ This hook is fired
     * *before* the $polylang object is available. /!\ The languages are also not
     * available yet.
     */
    do_action( 'pll_model_init', $model );
  • src/filters-links.php line 131
    /**
     * Filters a post or custom post type link.
     */
    apply_filters( 'pll_post_type_link', $link, $lang, $post );
  • src/translated-object.php line 382
    /**
     * Filters whether a synchronization capability check should take place.
     */
    apply_filters( "pll_pre_current_user_can_synchronize_{$this->type}", true, $id );
  • pll_pre_init

    action
    src/class-polylang.php line 268
    /**
     * Fires after the $polylang object is created and before the API is loaded
     */
    do_action_ref_array( 'pll_pre_init', array( &$polylang ) );
  • src/frontend/frontend-links.php line 63
    /**
     * Filters the translation url before Polylang attempts to find one. Internally
     * used by Polylang for the static front page and posts page.
     */
    apply_filters( 'pll_pre_translation_url', '', $language, $queried_object_id );
  • src/settings/flags.php line 296
    /**
     * Filter the list of predefined flags
     */
    apply_filters( 'pll_predefined_flags', $flags );
  • src/settings/settings.php line 402
    /**
     * Filters the list of predefined languages.
     */
    apply_filters( 'pll_predefined_languages', $languages );
  • src/frontend/choose-lang.php line 232
    /**
     * Filter the visitor's preferred language (normally set first by cookie if
     * this is not the first visit, then by the browser preferences). If no
     * preferred language has been found or set by this filter, Polylang fallbacks
     * to the default language
     */
    apply_filters( 'pll_preferred_language', $language, $cookie );
  • src/links-permalinks.php line 101
    /**
     * Tells when Polylang is able to prepare rewrite rules filters. Action fired
     * right after `wp_loaded` and just before WordPress
     * `WP_Rewrite::flush_rules()` callback.
     */
    do_action( 'pll_prepare_rewrite_rules', $this );
  • src/frontend/choose-lang.php line 300
    /**
     * When a visitor reaches the site home, Polylang redirects to the home page in
     * the correct language. This filter allows plugins to modify the redirected
     * url or prevent this redirection /!\ this filter may be fired *before* the
     * theme is loaded
     */
    apply_filters( 'pll_redirect_home', $redirect );
  • src/frontend/frontend-filters-links.php line 246
    /**
     * Filters the list of rel hreflang attributes
     */
    apply_filters( 'pll_rel_hreflang_attributes', $hreflangs );
  • src/modules/REST/Request.php line 225
    /**
     * Filters the object type of the current request.
     */
    apply_filters( 'pll_rest_request_object_type', null, $this->handler, $this->request );
  • src/links-permalinks.php line 204
    /**
     * Filters the list of rewrite rules filters to be used by Polylang.
     */
    apply_filters( 'pll_rewrite_rules', $types );
  • src/settings/table-string.php line 449
    /**
     * Filters the string translation before it is saved in DB. Allows to sanitize
     * strings registered with pll_register_string().
     */
    apply_filters( 'pll_sanitize_string_translation', $translation, $this->strings[ $key ]['name'], $this->strings[ $key ]['context'], $this->strings[ $key ]['string'], $mo->translate_if_any( $this->strings[ $key ]['string'] ) );
  • pll_save_post

    action
    src/crud-posts.php line 151
    /**
     * Fires after the post language and translations are saved.
     */
    do_action( 'pll_save_post', $post_id, $post, $this->model->post->get_translations( $post_id ) );
  • src/settings/table-string.php line 477
    /**
     * Fires after the strings translations are saved in DB
     */
    do_action( 'pll_save_strings_translations' );
  • pll_save_term

    action
    src/crud-terms.php line 168
    /**
     * Fires after the term language and translations are saved.
     */
    do_action( 'pll_save_term', $term_id, $taxonomy, $this->model->term->get_translations( $term_id ) );
  • src/frontend/choose-lang.php line 344
    /**
     * This filter allows to set the language based on information contained in the
     * main query
     */
    apply_filters( 'pll_set_language_from_query', false, $query );
  • src/settings/view-languages.php line 31
    /**
     * Fires when loading the active Polylang settings tab Allows plugins to add
     * their own tab
     */
    do_action( "pll_settings_active_tab_{$active_tab}" );
  • src/settings/settings.php line 72
    /**
     * Filter the list of setting modules
     */
    apply_filters( 'pll_settings_modules', $modules );
  • src/admin/admin-base.php line 725
    /**
     * Filter the list of sub-menu items in Polylang settings.
     */
    apply_filters( 'pll_settings_tabs', $tabs );
  • src/Switcher/Switcher.php line 80
    /**
     * Filter the whole HTML markup returned by the 'pll_the_languages' template
     * tag.
     */
    apply_filters_deprecated( 'pll_the_languages', array( $html, $this->settings->get_legacy() ), '3.9.0', 'pll_language_switcher_output' );
  • src/Switcher/Settings/Abstract_Settings_Legacy.php line 102
    /**
     * Filter the arguments of the 'pll_the_languages' template tag.
     */
    apply_filters_deprecated( 'pll_the_languages_args', array( $settings ), '3.9.0', 'pll_language_switcher_settings' );
  • src/modules/sync/sync-metas.php line 115
    /**
     * Filter a meta value before is copied or synchronized
     */
    apply_filters( "pll_translate_{$this->meta_type}_meta", $value, $key, $lang, $from, $to );
  • src/translated-post.php line 384
    /**
     * Fires after a media translation is created
     */
    do_action( 'pll_translate_media', $post_id, $tr_id, $lang->slug );
  • src/frontend/frontend-links.php line 178
    /**
     * Filter the translation url of the current page before Polylang caches it
     */
    apply_filters( 'pll_translation_url', $url, $language->slug );
  • src/Model/Languages.php line 789
    /**
     * Fires when a default language is updated.
     */
    do_action( 'pll_update_default_lang', $slug, $prev_default_lang );
  • src/Model/Languages.php line 460
    /**
     * Fires after a language is updated.
     */
    do_action( 'pll_update_language', $args, $lang );
  • pll_upgrade

    action
    src/install/upgrade.php line 120
    /**
     * Fires after Polylang has been upgraded and before the new version is saved
     * in options.
     */
    do_action( 'pll_upgrade' );
  • src/functions.php line 82
    /**
     * Filters whether we should load the block editor plugin or the legacy
     * languages metabox.
     */
    apply_filters( 'pll_use_block_editor_plugin', ! defined( 'PLL_USE_BLOCK_EDITOR_PLUGIN' ) || PLL_USE_BLOCK_EDITOR_PLUGIN );
  • src/install/plugin-updater.php line 63
    /**
     * Fires after the $edd_plugin_data is setup.
     */
    do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
  • src/admin/admin-filters.php line 53
    /**
     * This filter is documented in wp-includes/user.php
     */
    apply_filters( 'pre_user_description', $description );
  • src/Model/Languages.php line 1141
    /**
     * Filters the unserialized translation group description before it is updated
     * when a language is deleted or a language slug is changed.
     */
    apply_filters( 'update_translation_group', $tr, $old_slug, $new_slug, $term );
  • src/modules/wizard/view-wizard-step-licenses.php line 12 · used in 5 places
    apply_filters( 'pll_settings_licenses', array() );
  • src/modules/wizard/wizard.php line 283
    do_action( 'admin_enqueue_scripts' );
  • admin_head

    action
    src/modules/wizard/view-wizard-page.php line 52
    do_action( 'admin_head' );
  • src/install/plugin-updater.php line 715
    apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
  • src/modules/wpml/wpml-legacy-api.php line 92
    apply_filters( 'icl_ls_languages', $arr );
  • src/install/plugin-updater.php line 343
    do_action( "in_plugin_update_message-{$file}", $plugin, $plugin );
  • src/olt-manager.php line 89
    do_action_deprecated( 'pll_translate_labels', array(), '3.7', 'change_locale' );
  • pll_uninstall

    action
    uninstall.php line 51
    do_action( 'pll_uninstall' );
  • src/modules/wizard/wizard.php line 805
    apply_filters( 'pll_wizard_create_home_page_translations', array( $this, 'create_home_page_translations' ) );
  • src/modules/wizard/wizard.php line 209
    apply_filters( 'pll_wizard_steps', $this->steps );
  • src/modules/wpml/wpml-api.php line 175
    apply_filters( 'wpml_language_form_input_field', $field, $lang );
  • src/modules/wpml/wpml-api.php line 366
    do_action( 'wpml_language_has_switched', $lang, $cookie, self::$original_language );

Generated from Polylang'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: