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 topic contains 6 replies, has 2 voices.

Last updated by Bruno Kos 3 months, 1 week ago.

Assigned support staff: Bruno Kos.

Author Posts
July 10, 2019 at 8:36 am #4177345

Thibaut Marhuenda

Hello,
I have a problem I cannot resolve and which very strange.
I'm using WPML for a real estate website.
I import listings with the plugin wp all import in the main language (English) and also their translations (French).

On my french listing pages results, the listing is displayed correctly with the translation in French.
hidden link

Inside the results, I have some listings in the original language (English) which open correctly, but all listings in French (translated) shows an error 404
Ex hidden link will be redirected to hidden link which display an error 404.

I checked the original listing and then from edit open in French and the translation is present, but I cannot access it every time it is redirected to another URL and error 404.
This happens for most of the listings in French.

I tried to check in database and I cannot find anything which makes difference between the translated listings that open and the one that is redirected and have a 404 error.

Can you tell me how to solve this as it pauses quite big issues?

Also, it seems, many listings in French were not matched properly with English, how can I remove all the French post which not have English source.

July 10, 2019 at 10:07 am #4178115

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting WPML support!

From what I see, the URLs seems to be incorrect for some of the listings:
hidden link
-- works

hidden link
-- doesn't work

So for each listing where we have /propriete/, it does not seem to work. Can you tell me if you translated the slug from /property/ to /propriete/?

You could do it like this:
https://wpml.org/documentation/getting-started-guide/translating-page-slugs/#enabling-custom-post-type-name-localization-in-wpml

And then resave WordPress permalinks, so that is takes effect. If this doesn't update URLs, perhaps it may be required to update them directly in database using plugins such as:
https://wordpress.org/plugins/better-search-replace/

Once you do with the above - translating the slug - if you tried to create a new property and translation, can you tell me which slug is now there? Is the listing working?

Also, it seems, many listings in French were not matched properly with English, how can I remove all the French post which not have English source.

You do not have to delete them - you can connect them with their translations ( if you have any).
https://wpml.org/forums/topic/link-two-translations/#post-412971

There is also one last thing that comes to my mind at this point - if you're continuously importing these, perhaps there is a difference between what import file holds and the slug setting/translation on this page, so there may be a conflict as well - import file importing the wrong nonexisting slugs.

Regards,
Bruno Kos

July 10, 2019 at 11:53 am #4179763

Thibaut Marhuenda

Hello,
thank you for your answer.
The slug translation is translated from property (english) to propriete (french)
As you can see here:hidden link

And for some listings, the slug works property:
1. hidden link ---> this is working french listing which match english translation
2. hidden link ---> french version of the website a listing displayed in english as the french translation was not match

Any idea why some are working and some not.
When I import I have several feed:
Full listings / Listing updated created within the last 24h
and I did that for english and french and for the different types of listings.

I have the wpml addon and match listings on their unique reference and I select the parent feed in english as you can see
hidden link

----
There is also one last thing that comes to my mind at this point - if you're continuously importing these, perhaps there is a difference between what import file holds and the slug setting/translation on this page, so there may be a conflict as well - import file importing the wrong nonexisting slugs.

I think it come from this part.

----
I think better I remove all listings in french as I have too many orphans (3000+ set as draft french)
How can I do I tried with wp cli to delete all posts in draft it delete in english but not in french
-----
Thx for your help

July 10, 2019 at 12:49 pm #4180397

Thibaut Marhuenda

I tried to understand but it's quite strange
This is the english version
hidden link
Then I edit
hidden link and can see there is french translation
My french translation is correct with the good slug
hidden link
But when I want to go

ps I checked and no sign of it in the redirection so I don't think the problem come from redirection, I tried also to disable it

But if you visit hidden link it will redirect to the english version!
impossible to access to the french version.

and I think when it show error 404 it's the french version exist but as it try to redirect to the english version it which doesn't exist it shows error 404

---
do you have any idea how to solve it?

July 10, 2019 at 1:13 pm #4180563

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

But if you visit hidden link it will redirect to the english version!
impossible to access to the french version.

I have opened this page, but it did not redirect me to English (see the image). However, I opened it up in the incognito mode, so no caching. What about resaving permalinks after the new properties import?

and I think when it show error 404 it's the french version exist but as it try to redirect to the english version it which doesn't exist it shows error 404

It does make sense - what about caching perhaps? I see that you have Redis plugin, but also a redirection plugin.

Related to your question about deleting drafts:


wp post delete $(wp post list --post_type='property' --post_status=draft --format=ids)

Something like this will work, but it will delete all of them. Distinguishing by language is not possible with wp-cli I believe, because translation information is stored in several places:
https://wpml.org/forums/topic/remove-all-translated-posts/#post-2470877

Regards,
Bruno Kos

July 12, 2019 at 5:17 am #4195237

Thibaut Marhuenda

Hello,
thx for your help.
I try to import all and it solve some of the issues.
Now I face another one, during the import it seems that listings were imported in french first so I have pictures for french listings but now pictures for english (main language)

Anyway to make all the media attachments available from French (second language) to english (main language)
Ex: English no picture: hidden link
French translation with pictures: hidden link

This happen for quite a lot of listings

Thx by advance

Thx by advance

July 12, 2019 at 9:50 am #4197281

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Now I face another one, during the import it seems that listings were imported in french first so I have pictures for french listings but now pictures for english (main language)

I assume that you are selecting "English" on this step, or?
https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/#how-to-import-posts

Is this fixing the gallery/images issue?
https://wpml.org/documentation/getting-started-guide/media-translation/#media-translation-settings

Click "Start".

How is this gallery added anyway? What happens if you open the original (French as it seems) and click "Update" - does the translation which is currently without images gets the images picked up?

Regards,
Bruno Kos

The topic ‘[Closed] Error 404 on certain listing with redirection’ is closed to new replies.