maximeschoeni / sublanguage

Multilanguage plugin for wordpress
42 stars 13 forks source link

Problems with custom post type URLs #10

Closed rimas-kudelis closed 7 years ago

rimas-kudelis commented 7 years ago

I have written a WP plugin which adds a Custom Post Type named rq_issue (https://github.com/rimas-kudelis/wp-issue-manager/). This CPT uses issue as its slug. Now when I try to combine my plugin with yours, I get into trouble:

In the original language (Lithuanian in my case), the taxonomy page which lists posts of rq_issue type works fine, as in, it lists all posts with correct URLs, which look like this:

http://localhost:8000/lt/issue/issue-slug/

However, when I switch language to English, here's what happens: the taxonomy page still lists these posts, but instead of using issue as a CPT slug, it now uses rq_issue, like this:

http://localhost:8000/en/rq_issue/issue-slug/

When I click any one of these links, it results in a 404 error.

I tried using word issue as an English translation for this particular CPT (even though the sublanguage settings page states that issue is the default), but in that case, even though the links are displayed correctly, clicking on any one of them results in an infinite redirect loop where http://localhost:8000/en/issue/issue-slug/ continuously redirects to itself.

Could we fix this somehow?

maximeschoeni commented 7 years ago

Thank you for submitting this issue and for the fix. I'll have a look at this...

rimas-kudelis commented 7 years ago

Note that #11 doesn't help avoid the infinite loop when translation matches the original.

I also forgot to mention in my initial comment that manually changing the URL from http://localhost:8000/en/rq_issue/issue-slug/ to http://localhost:8000/en/issue/issue-slug/ opened the CPT page as expected, so the problem was only in the listing.

maximeschoeni commented 7 years ago

Ok I just corrected an issue that caused this redirect loop (when a post-type translation was the same as the original).

Thanks again for your fix!

rimas-kudelis commented 7 years ago

Thank you for reacting so swiftly!