- ステータス
- 解決済み
- 報告対象
- WPForms Multilingual 0.3.6
- 解決されたバージョン
- WPForms Multilingual 0.4.0
- 関連するプラグイン/テーマ
- WPForms
- トピックタグ
- Compatibility
問題の概要
WPFormsおよびそのWPForms Form Pagesアドオンを使用している場合、カスタムパーマリンク構造(例:/artikel/%postname%/)のセカンダリ言語のフォームページにアクセスすると、404エラーが発生する場合があります。
回避策
続行する前に、必ずサイトの完全なバックアップを作成してください。
- …/wp-content/plugins/wpforms-form-pages/src/Frontend.phpファイルを開きます。
- 78行目を探します。
- 次のコードを:
$request = ! empty( $request ) ? sanitize_key( wp_parse_url( $request, PHP_URL_PATH ) ) : '';
- 以下に置き換えます:
if ( ! empty( $request ) ) { // Parse the URL to get the path component $path = wp_parse_url( $request, PHP_URL_PATH ); // Use a regular expression to remove the language segment (e.g., "/en/") from the path // This pattern assumes the language code is always two characters and follows the first "/" $path = preg_replace( '#^/([a-zA-Z]{2})/#', '/', $path ); // Sanitize the resulting path $request = sanitize_key( $path ); } else { $request = ''; }