Saltar navegación

Open

Reported for: WPForms Multilingual 0.3.6

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:
    			$request = ! empty( $request ) ? sanitize_key( wp_parse_url( $request, PHP_URL_PATH ) ) : '';
    
  • With:
    			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 = '';
    			}
    

Deje una respuesta

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

Puede utilizar estas etiquetas:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>