Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue with the BetterDocs plugin on a multilingual site using WPML. When attempting to switch languages on a specific page, the redirection fails, stopping at an intermediate page instead of reaching the correct translated page. This issue is observed with incorrect URLs being generated for language switches.

Solution:
We recommend modifying the BetterDocs plugin code to ensure correct URL generation when switching languages. Here are the steps:
1. Open the file

wp-content\plugins\betterdocs-pro\includes\class-multiple-kb.php

.
2. Locate the function

doc_category_link

around line 695.
3. Replace the existing code with the following snippet:

public static function doc_category_link($termlink, $term, $taxonomy)<br />{<br />    if ($taxonomy != 'doc_category') return $termlink;<br /><br />    $kb_slug = self::kb_slug();<br /><br />    // WPML Workaround for compsupp-6478<br />    if (class_exists('SitePress')) {<br />        $kb_arr = get_term_meta($term->term_id, 'doc_category_knowledge_base', true);<br />        $kb_slug = $kb_arr[0];<br />    }<br /><br />    if (empty($kb_slug)) {<br />        $category = get_term_by('slug', $term->slug, $taxonomy, ARRAY_A);<br />        $kb_arr = get_term_meta($category['term_id'], 'doc_category_knowledge_base', true);<br /><br />        if (empty($kb_arr[0])) {<br />            $kb_slug = 'non-knowledgebase';<br />        } else {<br />            $kb_slug = $kb_arr[0];<br />        }<br />    }<br /><br />    return str_replace('%knowledge_base%', $kb_slug, $termlink);<br />}

This modification should correct the URL generation issue. If this solution does not resolve your problem, or if it seems outdated or irrelevant to your case, please visit our support forum to open a new ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins.

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.

Tagged: 

This topic contains 44 replies, has 2 voices.

Last updated by Osama Mersal 2 years ago.

Assisted by: Osama Mersal.

Author Posts
September 2, 2022 at 6:38 am #11975963

alexeyK-12

Hello. We need to solve the problem very urgently, since we have a project launch soon, and we saw a problem in the work of plagin betterdox.
We will try to describe the problem and show a video of incorrect operation.
We will give access to the admin panel (give an email address)
Transfer to a specialist immediately, please, very little time, you need to quickly decide.

1. multilingual site
2. Use WPML Your documentation says you recommend it.
3. there are knowledge bases in 3 languages ​​(related clones in three languages). tools level.
there are categories in 3 languages, clones are all interconnected.
each has its own templates in elementor.

rus hidden link
English hidden link

When we try to switch the language to Russian on this page:
hidden link

We should be redirected to this page:
hidden link

But for some reason, everything stops at the instrument levels (and doesn’t work further) hidden link

here is a message we wrote in support of the betterdox plugin and showed them this video (5 days available)
hidden link

they did a bunch of checks and gave this answer:

Hello Alexey,

I can assure you that we have tried our best to figure out the issues. We can see that these two pages are translated correctly here. Please check this screencast - hidden link

But perhaps, the translating button is not triggering here for misconfiguration. This is why I requested you to contact WPML support.

we ourselves saw a strange fact.
When we hover over the flag with the mouse hidden link below we see the correct link.

When we point at the Ukrainian flag or Russian, we also see incorrect links from below:
hidden link
hidden link
because each language has its own slug for instrumental levels
hidden link

September 4, 2022 at 10:34 am #11983873

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply due to a higher workload. Thanks for the explanation and the video.

I would need to take a closer look at your site. So I would need to request temporary access (WP-Admin and FTP)
– preferably to a test site where the problem has been replicated if possible –

Here is my email: osama.m@onthegosystems.com

Your next answer will be private, which means only you and I can access it.

❌ Please backup your database and website ❌

✙ I would need your permission to de-activate and re-activate Plugins and the Theme and change configurations on the site. This is also a reason the backup is critical.

✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.

Thanks for your cooperation and patience

Best regards,
Osama

September 5, 2022 at 4:39 am #11986111

alexeyK-12

Hello.
We can give you access to (WP-Admin and FTP).
We'll make a backup.
But we are not able to give you a test site.
We can also make an archive of the site, databases for you. Send it to you and you can deploy and test it anywhere.
You wrote that you could make a copy of the site, in order to be able to deal with the problem.
Please make a copy of the site and already disable and enable everything you need in it.
But we can't suspend work on the original site. Much time has been lost. It is necessary that our employees continue to fill the site with content.

Does everything that I described above suit you?

September 5, 2022 at 8:23 am #11987391

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for your update. I won't make any changes on your live site except installing the duplicator plugin to take a local copy of your site.
After that, I'll check the issue on my local server and let you know my findings.

If that sounds like a good plan, please provide the access details in the following private reply.

Thanks for your cooperation

Regards,
Osama

September 5, 2022 at 11:42 am #11989311

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for the access details. I couldn't replicate the issue on my local installation because the issue persists when the "Enable Multiple Knowledge Base" is enabled and can't be enabled without the license.

However, the pages work correctly when using [guide/%doc_category%/] as a Single Docs Permalink.

Also, I noticed that the slugs were not correctly translated on WPML-> String Translation, so could you please check the slugs translation, resave the permalinks and check the issue?

Thanks for your cooperation

Regards,
Osama

September 5, 2022 at 3:18 pm #11990981

alexeyK-12

Hi. I don't understand what happened to our site broke.
We will be backtracking....
we have given you all access as soon as you download a copy of the site .... we will take away access to the original site.
We will use your advice again.

September 5, 2022 at 3:31 pm #11991075

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for your update. Please let me know when you check the slugs in WPML-> String Translation and if that fixed the issue on your site.

Also, please check the docs post type, docs category, and docs knowledge base from WPML-> Settings-> Post Types Translations/ Taxonomy Translation sections.

Best regards,
Osama

September 6, 2022 at 7:24 am #11993599

alexeyK-12

I beg you to show a screen what needs to be checked.
Because we have checked a lot, and some we do not understand what you mean.

September 6, 2022 at 8:39 am #11994195

alexeyK-12

here is the translation included
hidden link

knowledge base slugs are also translated
hidden link
hidden link
hidden link
hidden link

the categories are also translated and the hierarchy is synchronized.
there are no slugs themselves in the translation of strings, only in Taxonomy Translation

September 6, 2022 at 8:56 am #11994369

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

1) Kindly check the video to see where to check the slug translation or change them. (hidden link)

You might need to check them in the following places:
1- WPML-> String Translation
2- WPML-> Settings-> Taxonomy Translation

Please note you would need to re-save the permalinks after changing the slug translation.

2) I can't check the issue on the local copy because the BetterDocs is not Pro, so please let me know if you could provide a staging site with the same issue and Pro version.

Or please upload the BetterDocs on this sandbox site and replicate the issue. (hidden link)

Thanks for your cooperation

Regards,
Osama

September 7, 2022 at 10:31 am #12004047

alexeyK-12

Hello .
We checked everything according to your recommendations.
We have everything almost the same as yours, but we saw that you have beterdox not a PRO version.
Perhaps because of this and inconsistencies.
Could you record the same video only on Betherdox PRO? Then we would check everything in more detail.

September 7, 2022 at 10:37 am #12004109

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

1) The duplicator copy I downloaded from your site didn't contain the Pro version, or it's not working because of the license.

2) Could you please upload only the better docs plugin to the sandbox site and activate the Pro version? After that, please try to replicate the same issue. (hidden link)

Thanks,
Osama

September 7, 2022 at 3:41 pm #12007141

alexeyK-12

maybe then you yourself look at these settings on our website.
On the working site (original), just if you find inaccuracies, then show with a screen what to fix, we will fix it ourselves and so we will know exactly what has changed and what consequences this will entail.

September 7, 2022 at 4:23 pm #12007319

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

1) Sure, I can check on your site, but please take a database backup and provide the access details. [Kindly use the fields for the private reply.]

2) It would be better to check the issue on the sandbox site to make sure it's not a compatibility issue. (hidden link)

Also, if the issue is replicated on a clean installation, that would give us a safe environment where we can debug the issue.

Thanks for your cooperation

Regards,
Osama

September 8, 2022 at 4:24 am #12009923

alexeyK-12

please tell me from what time and until what time GMT you will work with the site?
And secondly, we ask you to view our site while recording a video and tell us what is still not set up that way.
We will make adjustments according to your recommendations and we will understand what changes still need to be made on the site (after the adjustments have been made) - THIS IS IMPORTANT