NO BUG: WPML integration error on new update + HOW TO FIX

================================================================================

WPML + BRICKS THEME INTEGRATION BUG REPORT & FIXES

Date: November 25, 2025
Site: amint.alpinet.ch
Bricks Theme Version: 2.1.4
WPML Version: 4.8.5

================================================================================

PROBLEM SUMMARY

The site experienced multiple critical errors preventing proper operation:

  1. Fatal Error: Missing WPML method
  2. Apache redirect loops (AH00124 errors)
  3. TypeError in WPML string translation

================================================================================

ISSUE #1: MISSING get_translated_component() METHOD

ERROR MESSAGE:
Fatal error: Uncaught Error: Call to undefined method
Bricks\Integrations\Wpml\Wpml::get_translated_component()
in wp-content/themes/bricks/includes/helpers.php:1108

CAUSE:
The Bricks theme helpers.php file (line 1108) calls
Wpml::get_translated_component() method, but this method was missing from
the WPML integration class in wp-content/themes/bricks/includes/integrations/wpml/wpml.php

This is a Bricks 2.1+ feature for translating components that wasn’t present
in the active theme files.

SOLUTION:
Added three missing methods to wpml.php:

  • get_translated_component() - Main method to translate components on-the-fly
  • get_translated_elements() - Helper to translate element settings
  • get_translated_component_properties() - Helper to translate component properties

These methods allow WPML to translate Bricks components using the WPML
String Translation API.

FILE MODIFIED:
wp-content/themes/bricks/includes/integrations/wpml/wpml.php
(Added approximately 250 lines of code at the end of the class)

================================================================================

ISSUE #2: APACHE REDIRECT LOOPS (AH00124)

ERROR MESSAGE:
AH00124: Request exceeded the limit of 10 internal redirects due to probable
configuration error. Use ā€˜LimitInternalRecursion’ to increase the limit if
necessary.

CAUSE:
The .htaccess file had hardcoded rewrite rules that only worked with the
/en/ directory:

  • RewriteBase /en/
  • RewriteRule . /en/index.php [L]
  • Language-specific login redirects hardcoded

This configuration caused infinite redirect loops when accessing:

  • French language pages (/fr/)
  • Root URLs
  • Admin pages with language parameters

SOLUTION:
Fixed .htaccess rewrite rules to properly support WPML multi-language setup:

  • Changed RewriteBase from /en/ to /
  • Changed final RewriteRule from /en/index.php to /index.php
  • Removed hardcoded language-specific login redirects

FILE MODIFIED:
.htaccess (root directory)

BEFORE:

RewriteBase /en/
RewriteRule ^index\.php$ - [L]
RewriteRule ^en/wp-login.php /en/wp-login.php [QSA,L]
RewriteRule ^fr/wp-login.php /en/wp-login.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /en/index.php [L]

AFTER:

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

================================================================================

ISSUE #3: TYPEERROR IN WPML STRING TRANSLATION

ERROR MESSAGE:
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on
string in wp-content/themes/bricks/includes/integrations/wpml/wpml.php:631

CAUSE:
After user modifications to the WPML integration file, the code attempted to
access nested array keys without validating that intermediate values were
actually arrays. This occurred in the wpml_page_builder_string_translated()
method when processing repeater field translations.

The code tried to access:
$path = &$bricks_elements[$index][ā€˜settings’][$setting_key][$repeater_index][$repeater_key];

But $setting_key sometimes contained a string value instead of an array,
causing the TypeError.

SOLUTION:
Added comprehensive validation before accessing nested array keys:

  1. Check if the setting exists and is an array
  2. Check if the repeater item exists and is an array
  3. Check if the repeater field exists
  4. Only then proceed with translation

Also added similar validation to component property translations.

FILE MODIFIED:
wp-content/themes/bricks/includes/integrations/wpml/wpml.php
(Lines 622-642 and 649-675)

================================================================================

ADDITIONAL WARNINGS (NON-CRITICAL)

WARNING TYPE:
PHP Warning: file_exists(): open_basedir restriction in effect

DETAILS:
WPML String Translation tries to load ACF translation files that are outside
the allowed server paths (/var/www/vhosts/alpinet.ch/:/tmp/)

Files it’s looking for:

  • acf-field-group–fr_FR.mo
  • acf-field-group–fr_FR.l10n.php
  • acf-field-group-0-fr_FR.mo

STATUS: These are harmless warnings and do not break functionality. WPML is
simply checking for translation files that don’t exist in the expected locations.

RECOMMENDATION: Can be safely ignored, or suppress by adjusting the
open_basedir PHP configuration if desired.

================================================================================

TECHNICAL DETAILS FOR DEVELOPER

KEY CONCEPTS:

  1. Bricks 2.1+ introduced component translation support via WPML
  2. Components can have properties with default values that need translation
  3. WPML uses ā€œString Packagesā€ to group translatable strings
  4. Each component gets its own package: ā€˜bricks-components’

WPML INTEGRATION METHODS ADDED:

  • get_translated_component($component): Main translation method
  • get_translated_elements($elements, $package): Translates element settings
  • get_translated_component_properties($properties, $package): Translates properties
  • register_components_string_packages($old_value, $value): Registers strings on save
  • process_component_properties_defaults($properties, $package): Processes defaults
  • declare_component_string_package_kind($active_kinds): Declares package type

HOW IT WORKS:

  1. When components are saved, strings are registered with WPML
  2. When components are loaded, translations are applied on-the-fly
  3. Translation lookup uses the WPML filter: ā€˜wpml_translate_string’
  4. Package format: {kind:ā€˜Bricks components’, name:component_id, title:component_name}

VALIDATION PATTERNS ADDED:

  • Always check is_array() before accessing nested array keys
  • Use isset() to verify intermediate keys exist
  • Validate array structure before attempting to create references with &

================================================================================

FILES MODIFIED (COMPLETE LIST)

  1. wp-content/themes/bricks/includes/integrations/wpml/wpml.php

    • Added get_translated_component() method
    • Added get_translated_elements() helper method
    • Added get_translated_component_properties() helper method
    • Added register_components_string_packages() method
    • Added process_component_properties_defaults() method
    • Added declare_component_string_package_kind() method
    • Added validation checks for repeater field access
    • Added validation checks for component property access
  2. .htaccess (root directory)

    • Fixed RewriteBase from /en/ to /
    • Fixed final RewriteRule from /en/index.php to /index.php
    • Removed hardcoded language-specific redirects

================================================================================

TESTING RECOMMENDATIONS

  1. Test both EN and FR language versions of the site
  2. Verify component translations work correctly
  3. Test WPML translation queue functionality
  4. Verify admin pages load without errors
  5. Check frontend pages in both languages
  6. Test wp-login.php access in both languages
  7. Verify no redirect loops occur
  8. Test ACF field groups (if used) with translations

================================================================================

FUTURE RECOMMENDATIONS

  1. Consider upgrading to latest Bricks theme version if available
  2. Keep WPML plugins updated to latest versions
  3. Monitor error logs for any new issues
  4. Consider adding unit tests for WPML integration
  5. Document any custom WPML configurations

================================================================================

REFERENCES

================================================================================

CONTACT FOR QUESTIONS

If you need clarification on any of these fixes or encounter additional
issues related to this integration, please review:

  1. The specific code changes in the modified files
  2. WPML debug logs (if enabled)
  3. PHP error logs for additional context
  4. Bricks theme changelog for version 2.1.4

================================================================================

END OF REPORT

Hi @wecodegeneva,

Please don’t post AI-generated reports like this. Instead, create a separate bug report for each issue, but only for problems that are specific to Bricks, with information directly related to the report. Issues related to Apache configuration aren’t related to Bricks. If you can, include steps to reproduce the issue so we can help you better. Thanks!

1 Like