WPML
add_filter( 'wpml_is_redirected', 'callable $function_to_add, 10, 3 );
タイプ
filter
カテゴリー
その他
WPMLバージョン
4.0.0

説明

WPMLは、一致するものが見つかった場合、訪問者を正規URLに自動的にリダイレクトしようとします。このフックを使用すると、このWPMLの機能を無効にすることができます。

引数

このフィルターには3つのパラメーターが渡されます。
$redirect
(bool) WPMLのカノニカルURLリダイレクトアクションを無効にするかどうかを定義する真偽値。
$post_id
(integer) 投稿ID
$query
(array) WordPressクエリ配列。

使用例

以下の例では、スラッグが「city」のカスタム投稿タイプに対するWPMLのカノニカルURLリダイレクトを防止します。

function mytheme_do_not_redirect_city_post_type( $redirect, $post_id, $query ) {
    if ( 'city' === $query->get( 'post_type' ) ) {
       return false;
     }
    return $redirect;
    };
add_filter( 'wpml_is_redirected', mytheme_do_not_redirect_city_post_type, 10, 3 );

icl_ls_languages, wpml_sync_custom_field_copied_value, wpml_ls_enable_ajax_navigation, wpml_element_type, wpml_setting, wpml_sub_setting, wpml_exclude_post_from_auto_translate, wpml_forms_config_ninja-forms, wpml_forms_config_wpforms, wpml_tf_feedback_open_link

すべてのその他フック(30件) →