Skip Navigation

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

Problem:
If you're experiencing issues with portfolio items disappearing when switching languages and receiving a 404 error page after switching languages on a product, follow these steps for a solution.
Solution:
1. Add the following code to your theme's

functions.php

file:

// WPML Workaround for compsupp-7272<br />function wpml_compsupp7272_brisk_filter_category_slug($slug) {<br />    if ( class_exists( 'Sitepress' ) ) {<br />        /* We need to register the same slug in all languages, then translate that slug with a string translator<br />        * So let's hardcode the slug here and translate it later<br />        */<br />        $slug = 'products-category';<br />    }<br />    return $slug;<br />}<br /><br />add_filter( 'uicore_portfolio_category_slug', 'wpml_compsupp7272_brisk_filter_category_slug' );<br /><br />$slug = apply_filters( 'uicore_portfolio_slug', $slug );<br /><br />function wpml_compsupp7272_brisk_filter_portfolio_slug($slug) {<br />    if ( class_exists( 'Sitepress' ) ) {<br />        /* We need to register the same slug in all languages, then translate that slug WPML > Settings > Post Type Translation<br />        * So let's hardcode the slug here and translate it later<br />        */<br />        $slug = 'products';<br />    }<br />    return $slug;<br />}<br /><br />add_filter( 'uicore_portfolio_slug', 'wpml_compsupp7272_brisk_filter_portfolio_slug' );

2. Go to the WPML String translator and translate the category slug.
3. Navigate to WPML > Settings > Post Type translation and translate the post type slug.
4. Visit Settings > Permalinks and re-save Permalinks.

We recommend checking the 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. If the solution provided here is irrelevant due to being outdated or not applicable to your case, please open a new support ticket at our support forum.

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.

Our next available supporter will start replying to tickets in about 7.28 hours from now. Thank you for your understanding.

Tagged: 

This topic contains 7 replies, has 3 voices.

Last updated by Osama Mersal 1 month, 1 week ago.

Assisted by: Osama Mersal.

Author Posts
March 18, 2024 at 4:55 pm #15422646

John

Hello,
Unfortunately the support I was talking on chat got disconnected.
I really don't know to explain perfectly the issue so you can understand, but I will do my best.
So I have and website where we are using the Portfolio to post some products. We are using also the theme builder to create a custom design for each portfolio category and also for the portfolio page.
We have translated the portfolio page and seems to be fine.
Now, we created a custom design using the theme builder for the category and here we have an issue. After we are switching between RO and EN the product disappears, also the slug in changing. Please check this video hidden link
The second issue it's when we enter on a product, after we are switching between RO and EN
we receive a 404 error page. Please check this video hidden link
Can you help me?
Please let me know if you need anything else from me.
Thank you!

March 19, 2024 at 9:47 am #15425091

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello there!

I'll help you get things started while a supporter takes your case.

1) Can you let me know if you tested this with only WPML enabled? or well, WPML and the page builder alone. you can deactivate all the plugins, make a small change to the category in the original language, then save the changes and translate it.

2) You mention a problem with the slug, that is changing? can you give me an example of how it should look and how it looks instead?

3) From the chat, i take it you use Litespeed. if you briefly deactivate it, do you keep encountering the issues?

Please let us know these 3 things so we can understand better how to continue.

Regards.

March 19, 2024 at 11:03 am #15425741

John

Hello,

Thank you for your reply.

1. Yes, I have deactivated the page builder and the issue persist. On product when I switch between RO and EN I will receive an 404 error.

2. Yes, this is the RO link : hidden link
and this is the translated link in EN : hidden link.
But after I switch between first link and second link, the third time the link it's changed to:
hidden link and the products dissapears.

3. You can eliminate the conflict between other plugins, because I have tried only with the WPML and the them plugins and the issue persist.

Please let me know if you need anything else from me.

Thank you!

March 19, 2024 at 2:16 pm #15426898

Osama Mersal
Supporter

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

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

Hi,

I'm Osama from WPML forums support. I'll be glad to help you today.

Please login to this sandbox site and install your theme. (hidden link)

After that, please create a test category and translate it to replicate the issue. If the issue is reproducible, please let me know how to reproduce it so I can check it and consult our second-tier support team if needed.

Thanks for your cooperation

Best regards,
Osama

March 20, 2024 at 2:38 pm #15432283

John

Hello,
I have done what you have asked me.
You will see if you switch from EN to RO also on product and category you will receive error 404.
Please let me know if you need something else from me.
Thank you!

March 20, 2024 at 3:06 pm #15432525

Osama Mersal
Supporter

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

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

Hi,

Thanks for replicating the issue. I've consulted our compatibility team, and I'll update you as soon as I get their reply.

Best regards,
Osama

March 21, 2024 at 7:50 pm #15438291

Osama Mersal
Supporter

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

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

Hi,

Thanks for your patience. Please check the following steps:

1- Add the following code to the functions.php:

// WPML Workaround for compsupp-7272
function wpml_compsupp7272_brisk_filter_category_slug($slug) {
    if ( class_exists( 'Sitepress' ) ) {
        /* We need to register the same slug in all languages, then translate that slug with a string translator
        * So let's hardcode the slug here and translate it later
        */
        $slug = 'products-category';
    }
    return $slug;
}

add_filter( 'uicore_portfolio_category_slug', 'wpml_compsupp7272_brisk_filter_category_slug' );

$slug = apply_filters( 'uicore_portfolio_slug', $slug );

function wpml_compsupp7272_brisk_filter_portfolio_slug($slug) {
    if ( class_exists( 'Sitepress' ) ) {
        /* We need to register the same slug in all languages, then translate that slug WPML > Settings > Post Type Translation
        * So let's hardcode the slug here and translate it later
        */
        $slug = 'products';
    }
    return $slug;
}

add_filter( 'uicore_portfolio_slug', 'wpml_compsupp7272_brisk_filter_portfolio_slug' );

2- Go to WPML String translator and translate the category slug
3- Go to WPML > Settings > Post Type translation and translate the post type slug
4- Go to Settings > Permalinks and re-save Permalinks

I've applied the above steps on the sandbox site. Please check if it works correctly. (hidden link)

If it works correctly, please get in touch with the theme support team and let them know our findings.

It would be great if you could urge the theme authors to join our Go Global Program.
You can find details about it here. (https://wpml.org/documentation/theme-compatibility/go-global-program/)

Best regards,
Osama

March 21, 2024 at 7:50 pm #15438292

Osama Mersal
Supporter

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

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

Hi,

Thanks for your patience. Please check the following steps:

1- Add the following code to the functions.php:

// WPML Workaround for compsupp-7272
function wpml_compsupp7272_brisk_filter_category_slug($slug) {
    if ( class_exists( 'Sitepress' ) ) {
        /* We need to register the same slug in all languages, then translate that slug with a string translator
        * So let's hardcode the slug here and translate it later
        */
        $slug = 'products-category';
    }
    return $slug;
}

add_filter( 'uicore_portfolio_category_slug', 'wpml_compsupp7272_brisk_filter_category_slug' );

$slug = apply_filters( 'uicore_portfolio_slug', $slug );

function wpml_compsupp7272_brisk_filter_portfolio_slug($slug) {
    if ( class_exists( 'Sitepress' ) ) {
        /* We need to register the same slug in all languages, then translate that slug WPML > Settings > Post Type Translation
        * So let's hardcode the slug here and translate it later
        */
        $slug = 'products';
    }
    return $slug;
}

add_filter( 'uicore_portfolio_slug', 'wpml_compsupp7272_brisk_filter_portfolio_slug' );

2- Go to WPML String translator and translate the category slug
3- Go to WPML > Settings > Post Type translation and translate the post type slug
4- Go to Settings > Permalinks and re-save Permalinks

I've applied the above steps on the sandbox site. Please check if it works correctly. (hidden link)

If it works correctly, please get in touch with the theme support team and let them know our findings.

It would be great if you could urge the theme authors to join our Go Global Program.
You can find details about it here. (https://wpml.org/documentation/theme-compatibility/go-global-program/)

Best regards,
Osama

March 26, 2024 at 11:24 am #15450856

John

Hello,
The code works.
Thank you very much for your support.

John confirmed that the issue was resolved on 2024-03-26 11:24:12.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.