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.

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

Problem: When I visit a post with the same slug of a sub page I get redirected to the sub page

Solution: Please follow this steps:
- Go to \plugins\sitepress-multilingual-cms\classes\query-filtering\class-wpml-404-guess.php:L36
- Replace:

$type  = $query->get( 'post_type' );

with:

$type  = $query->get( 'post_type' );
if (empty($type)) {
            $type = !empty($query->get( 'pagename' )) ? 'page' : 'post';
        }

Relevant Documentation:

This topic contains 13 replies, has 2 voices.

Last updated by Carlos Rojas 3 months, 2 weeks ago.

Assigned support staff: Carlos Rojas.

Author Posts
July 1, 2019 at 8:19 am

silmikko

Hi guys,

I have a site under construction at staging.riihonmajatalo.fi. The translation is done by a translation agency. They exported the xliff file, did the translations and imported the file back to my site. I think there might have happened something with the translation since when I deactivate WPML plugins, the issue disappears and when reactivating the plugins the issue comes back.

I have most of my site translated except blog posts and WooCommerse Store. How ever, this issue is related to one of the blog posts. I think one reason might be the slug that the blog post has. There is a sub page with the same slug. The urls are, of course, totally different. But as I said the issue disappears as I deactivate all the WPML related plugins. Of course, I could change the slug of the blog post and the issues disappear also, I have tested that. But that's not the answer I'm looking for. I',m looking for the exact string translation that may cause this issue, or what ever is the cause of this.

I have sent hours trying to figure this out but haven't find any solution. I just can't find where the particular translation might have happened which causes the redirection. Since it's not translated there is now url translated either, I suppose.

I use Astra Pro and Elementor Pro. The template I use to show the blog achieve is made with Elementor Pro. I haven't noticed any other unwanted redirections on the site.

Link to a page where the issue can be seen:

Please, see the video behind the link.

I expected to see:

Please, see the video behind the link.

On the video there are described two issues but the last issue is related to one other plugin that I have. So don't worry about that. The same issue exists on my live site where I don't have WPML activated at the moment.

Cheers,

mikko

July 1, 2019 at 10:56 am #4118115

Carlos Rojas
Supporter

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

Timezone: America/Montevideo (GMT-03:00)

Hi Mikko,
Thank you very much for creating this ticket.

Please follow this steps:
- Create a backup of the site.
- Finish the translation of 'Palvelut' page.
- Flush all cache memory.
- Deactivate the all the plugins except WPML plugins.
- If the issue disappeared start activating the plugins one by one until the issue re-appears.

Could you tell me the result of the steps above?

Regards,
Carlos

July 1, 2019 at 11:18 am #4118325

silmikko

Hi Carlos,

I finished the translation of "Palvelut". There was only Media Translation left to do.

I'll try deactivating the plugins next.

I have debug activated on my server. Have you taken a look at that yet? There is some line(s) of error with WMPL but I don't understand it.

mikko

July 1, 2019 at 11:31 am #4118463

silmikko

Hi Carlos,

I just redid deactivating the plugins. I did that even before sending the first ticket. I found no conflicts between WPML plugins and the rest. The only way to solve this issue seems to be deactivating WPML plugins, all of them.

mikko

July 1, 2019 at 11:49 am #4118553

Carlos Rojas
Supporter

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

Timezone: America/Montevideo (GMT-03:00)

Hi Mikko,
Thank you very much for your feedback.

This is a very strange issue. I have created a test site with a fresh new WordPress installation and I would like to ask you to try to reproduce the issue there. If the issue is 'reproducible' then I can escalate directly to our 2nd tier of support.

You can access the test site by following this link: hidden link

Were you able to reproduce the issue?

Regards,
Carlos

July 1, 2019 at 12:01 pm #4118565

silmikko

Hi Carlos,

I'm a bit confused here. What exactly do you want me to do? The site behind the link you sent me is almost empty, no posts, no plugins etc...

The other staging domain we made earlier for this other issue I had, is still active and the issue is alive there too.

mikko

July 1, 2019 at 12:40 pm #4118953

Carlos Rojas
Supporter

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

Timezone: America/Montevideo (GMT-03:00)

Hi Mikko,
I'm sorry if I didn't explain myself correctly.

I'm asking you to add dummy content in this test-empty site and reproduce the issue (basically one post and two pages). If you are able to reproduce the issue then I will automatically escalate this ticket to our 2nd tier of support.

If you can't reproduce the issue in the test site then we will have to get back to your site and try to find the cause of the problem.

Regards,
Carlos

July 1, 2019 at 1:40 pm #4119455

silmikko

Hi Carlos,

Just did a quick test. Imported a couple of pages and a blog post to this sandbox area. With this quick test I was not able to reproduce the issue.

What can we try next?

mikko

July 1, 2019 at 1:57 pm #4119725

Carlos Rojas
Supporter

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

Timezone: America/Montevideo (GMT-03:00)

Hi Mikko,

In this case I recommend you remove the content you imported and manually create the post and the two pages -remember that we only need to add the slug and titles- and try to reproduce the issue.

Does the issue appears with the manually created post and pages?

Regards,
Carlos

July 1, 2019 at 4:32 pm #4121173

silmikko

Hi Carlos,

I removed everything that I imported earlier and made everything from the scratch.

I WAS able to reproduce the issue. When I deactivate WPML plugins the issue disappears and when I reactivate the plugins the issue comes back.

There is my Blog Achieve template activated since I think that might have something to do with the issue - or not. That is how my site is set up anyway, so I thought I leave it there. LEIRIKOULU is the blog post to follow.

Sandbox site is really slow on everything that happens. Is that supposed to be as it is? For a while I thought I was able to do nothing with Elementor.

I hope this makes things easier to you trouble shoot.

mikko

July 2, 2019 at 9:42 am #4125407

Carlos Rojas
Supporter

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

Timezone: America/Montevideo (GMT-03:00)

Hi Mikko,
I was able to see the issue in the test site. Thank you very much for reproduce it!

I'm consulting our specialists about this issue and I will get back to you as soon as I have an answer.

Thank you very much for your patience and understanding!
Best regards,
Carlos

July 2, 2019 at 11:35 am #4126379

Carlos Rojas
Supporter

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

Timezone: America/Montevideo (GMT-03:00)

Hi Mikko,

Please follow this steps:
- Go to \plugins\sitepress-multilingual-cms\classes\query-filtering\class-wpml-404-guess.php:L36
- Replace:

$type  = $query->get( 'post_type' );

with:

$type  = $query->get( 'post_type' );
if (empty($type)) {
            $type = !empty($query->get( 'pagename' )) ? 'page' : 'post';
        }

Could you confirm that the issue is solved?

Regards,
Carlos

July 2, 2019 at 1:30 pm #4127421

silmikko

Hi Carlos,

Great - this fixed the issue.

Thank you so much : )

mikko

July 2, 2019 at 4:30 pm #4128743

Carlos Rojas
Supporter

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

Timezone: America/Montevideo (GMT-03:00)

Hi mikko,

I'm glad to hear that the issue is solved 🙂

Please don't hesitate to contact us if you need our help in the future with WPML. We will be more than happy to help.
Best regards,
Carlos