Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Elementor users - please update WPML to the latest version to maintain compatibility. More details here - https://wpml.org/changelog/2024/12/wpml-4-6-15-critical-update-for-elementor-sites/
Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 8 replies, has 1 voice.

Last updated by Marcel 2 days, 16 hours ago.

Assisted by: Marcel.

Author Posts
December 16, 2024 at 6:22 am #16515824

barjD-2

Background of the issue:
I am trying to translate a custom post type archive page, which uses a template file in a child theme. The issue can be seen on hidden link

I have tested disabling all plugins except:
WPML Media Translation
WPML Multilingual CMS
WPML SEO
WPML String Translation

However, the issue persists.

The above-named WPML plugins are the only WPML plugins installed on the site.

Symptoms:
The translated archive page appears differently than the original language template. This can be seen in the screenshots provided.

Questions:
Why does the translated archive page appear differently than the original language template?
How can I ensure the translated archive page matches the original language template?

December 17, 2024 at 5:32 am #16519727

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

This happens because there is a fatal error on the site:

There has been a critical error on this website.

Please provide us the WordPress debug.log (not WPML debug informations).
To enable it, open your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );

In this case, the errors will be saved to a debug.log file located in the /wp-content/ directory. This will allow us to identify the exact error occurring.

If you can paste your debug.log to pastebin.com and provide me that link it would be great! (This is the cleanest way, because sometimes the logs are long and create a complete mess in discussion).

Documentation:
https://codex.wordpress.org/Debugging_in_WordPress

Best Regards,
Marcel

December 17, 2024 at 6:06 am #16519765

barjD-2

Hello, for security reasons I can't use pastebin.

Here is a link to the debug file hidden link

Thank you for your reply and your help.

December 17, 2024 at 7:16 am #16519872

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Thanks!

A Fatal Error has been logged from your theme. Please see the details below:

[17-Dec-2024 05:17:23 UTC] PHP Fatal error:  Uncaught ArgumentCountError: 52 arguments are required, 1 given in /nas/content/live/***/wp-content/themes/monochrome-pro/archive-trustee.php:83
Stack trace:
#0 /nas/content/live/***/wp-content/themes/monochrome-pro/archive-trustee.php(83): printf('<a href="https:...')
#1 /nas/content/live/***/wp-includes/class-wp-hook.php(324): sk_fields('')
#2 /nas/content/live/***/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /nas/content/live/***/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /nas/content/live/***/wp-content/themes/genesis/lib/structure/loops.php(119): do_action('genesis_entry_c...')
#5 /nas/content/live/***/wp-content/themes/genesis/lib/structure/loops.php(38): genesis_standard_loop()
#6 /nas/content/live/***/wp-includes/class-wp-hook.php(324): genesis_do_loop('')
#7 /nas/content/live/***/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#8 /nas/content/live/***/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#9 /nas/content/live/***/wp-content/themes/genesis/lib/framework.php(66): do_action('genesis_loop')
#10 /nas/content/live/***/wp-content/themes/monochrome-pro/archive-trustee.php(88): genesis()
#11 /nas/content/live/***/wp-includes/template-loader.php(106): include('/nas/content/li...')
#12 /nas/content/live/***/wp-blog-header.php(19): require_once('/nas/content/li...')
#13 /nas/content/live/***/index.php(17): require('/nas/content/li...')
#14 {main}

The error originates from:
/wp-content/themes/monochrome-pro/archive-trustee.php on line 83. I recommend contacting the theme authors for assistance.

The additional PHP notices are related to this known issue: WPML Errata: PHP Error in WP 6.7 - _load_textdomain_just_in_time Notice.

Best Regards,
Marcel

December 17, 2024 at 7:46 pm #16523358

barjD-2

Thank you for your reply.

Could I ask, why does this template, named archive-trustee.php work perfectly in English but not in the translated language? It is indeed the code that controls the display of hidden link

I also ran the file through a PHP syntax checker, and it came up with no errors.

I am really confused by this 🙁

I have attached a screenshot so you can see line 83. Does anything stand out to you that would cause a WPML translation to not appear?

Or if it is more helpful, the entire file's code is here hidden link

Thank you again for your help.

Screenshot 2024-12-17 at 11.40.16 AM.png
December 18, 2024 at 8:49 am #16524765

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

I can see the issue from the screenshot. The problem occurs because printf() requires a format string with placeholders (e.g., %s) and corresponding arguments. If a plain string without placeholders or arguments is passed, it triggers an ArgumentCountError, especially when WordPress translations (like WPML) modify the content.

It looks like the link with the placeholder %s (set before line 82) may have been altered or broken in WPML → String Translation, which is causing the error. Please search for that string and ensure it includes %s inside the translation.

Let me know if you need further assistance!

Best regards,
Marcel

December 18, 2024 at 9:28 pm #16527815

barjD-2

Thank you very much for your help, it is much appreciated.

I have tried to search for the string with "%s" in it but when I enter "%s" in the search field by going to WPML > String Translation, and also select the domain of "genesis" or "monchrome-pro", it returns results for "all domains." There are over 4000 strings. None of the first results show strings with "%s" in them.

However, since the "%s" is trying to create a hyperlink to the custom post type's single posts, I think it is looking for a specific link, no? Wouldn't those links automatically be synced in WPML?

I have attached screenshots to show you what part of the English version it is trying to find, in case it sheds more light here.

Since the text of the hyperlink is "See bio," I searched for "See bio" in the strings, and the English doesn't contain "%s". But I added "%s" to the Punjabi field as you can see in the attached screenshot. However, it did not solve the issue.

Could you help direct us further in figuring out what string WPML is looking for, and where we need to add "%s"?

Thank you very much again.

Screenshot 2024-12-18 at 1.21.22 PM.png
image link s - wpml break 2024-12-18 at 1.18.30 PM.png
no results with s 2024-12-18 at 1.18.03 PM.png
See bio string 2024-12-18 at 1.13.40 PM.png
more link - see bio- wpml 2024-12-18 at 1.12.49 PM.png
see bio button 2024-12-18 at 1.12.02 PM.png
December 19, 2024 at 12:37 pm #16530172

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

The link visible as "a href" in line 83. It comes from the sprintf function, not from the __() gettext call that loads "See bio":

<a href="%s" class="more-link">%s</a>

You can search for this link and use the "Exact Match" filter checkbox to locate it.

Best regards,
Marcel

December 19, 2024 at 6:27 pm #16531481

barjD-2

Thank you Marcel.

I rescanned the themes just in case before searching.

I have tried to search for "%s" using exact match and "a href" in String Translation but nothing comes up.

If I go to the Admin texts screen to search, both terms brings up results but they are not related to this string. I did look through the 3 pages of results for "%s" under admin text for translation too.

I have attached screenshots for you to see.

Is there a specific phrase I should be searching for other than "a href" or "%s"?

I may be away for a litte while but please don't close this ticket if you don't hear back from me right away.

Screenshot 2024-12-19 at 10.20.57 AM.png
Screenshot 2024-12-19 at 10.20.30 AM.png
Screenshot 2024-12-19 at 10.20.18 AM.png
Screenshot 2024-12-19 at 10.19.46 AM.png
December 19, 2024 at 6:29 pm #16531538

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

if you select "Exact Match" you need to exactly search for "%s". "a href" alone is not a match otherwise.

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT
-Please make a backup of site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Best Regards,
Marcel

December 20, 2024 at 12:08 pm #16533864

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

Thank you for providing access. I recreated the same entry identically, and it is displaying correctly here: hidden link.

I found that the issue only occurs when the permalink for the translated listing uses Indian characters. For example, if you edit the permalink in this listing: hidden link">Edit Listing and change it from /test1/ to ਕੁਲਵਿੰਦਰ-ਸਿੰਘ-ਢਾਹਾਂ2, the issue appears.

This indicates that the problem is not with the archive page itself, but with the included listing. It seems to be caused by how Unicode characters are handled in the theme’s code.

You will need to contact your theme’s authors to address this, as it is likely a coding issue. Certain functions may not properly handle Unicode characters if they are not correctly encoded. The authors may need to implement a different approach.

I tested the issue by encoding the permalink using esc_url() and rawurlencode() to handle Unicode characters, but the problem persists. This suggests the issue may be related to the server’s handling of Unicode or the database's character set/collation.

Best Regards,
Marcel