Skip Navigation

Resolved

Reported for: WPForms Multilingual 0.3.6

Resolved in: WPForms Multilingual 0.4.0

Topic Tags: Compatibility

Overview of the issue

If you are using WPForms and its WPForms Form Pages addon, you may encounter a 404 error when accessing form pages in secondary languages with a custom permalink structure (e.g., /artikel/%postname%/).

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open …/wp-content/plugins/wpforms-form-pages/src/Frontend.php file.
  • Look for line 78.
  • Replace:
    1
    $request = ! empty( $request ) ? sanitize_key( wp_parse_url( $request, PHP_URL_PATH ) ) : '';
  • With:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    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 = '';
    }