I have a website with ACF + WPML installed. When I save posts that have a translation made with the "Duplicate" button from WPML, I get this error: PHP Fatal error: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /var/web/site/public_html/wp-content/plugins/wpml-string-translation/classes/filters/strings-filter/class-wpml-register-string-filter.php:205
When creating the page in English, we want to duplicate the page (and not only add a translation).
When doing so (I did a test with the page you've created), the second time a block is use (for this example, I've used Membres), the fields are empty when reloading the admin.
You can check with WPML TEST and WPML TEST EN (which are both fr and en respectively).
I suspect the problem is caused with the repeater and WPML is not capable of putting a unique identifier to both blocks.
Sorry for the delay, we seem to be on different timezone 🙂
I was able to see the issue with the membres block.
However, I am not able to reproduce with a new acf block added through ACF field groups, for example the WPML block is added to the membres block and it works OK.
How are the fields Ancre and Titre added?
I wonder if this has possibly something to do with code configuration, are these added using custom code?
It is hard to tell, the best way would be to review the code used to add the acf block, at the moment the issue is pointing toward the custom code as this issue does not happen with standard ACF fields.
Please share this with me to further review and how you would add this block if you had to re produce the issue in a clean environment
//Register the block with ACF
function treize_register_block($settings)
{
if (class_exists('ACF')) {
acf_register_block_type($settings);
}
}
//Create Block categories
add_filter('block_categories_all', function ($categories) {
// TODO: Adjust depending on how your fields need to be categorized
$categories[] = array(
'slug' => 'hero',
'title' => 'En-t�te'
);
The topic ‘[Closed] Uncaught TypeError: strlen()’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.