[Resolved] ACF custom taxonomy slug translation not working
This thread is resolved. Here is a description of the problem and solution.
Problem:
ACF custom taxonomy (i.e. using %season% as a URL tag in permalinks) slug translation not working.
Solution:
It turns out that unlike standard permalink tags (i.e. %postname%, %category%, %post_id% and etc), the %season% is a custom permalink tag. Thus it needs to be incorporate and be handled using custom code.
Unfortunately, custom coding is out of scope of this forum. However, following these examples, you can use to register your custom URL tag in WordPress and achieve the purpose. Please see the following articles:
Alternate Solution: (Shared by WPML User)
"After installing the following free version of the plugin, one is able to set the desired translations at the plugins settings and the links work properly now: https://wordpress.org/plugins/permalink-manager/"
All latest updates used in a development site.
I have created a CPT (Traditions / Δρώμενα) and custom taxonomy (Season / Εποχή).
I have designated custom urls for the cpt and the taxonomy in ACF.
English (primary) language permalinks work properly, However when switching to Greek I get a url that leads to a 400 error.
Parents work properly: hidden link
translates to hidden link
Taxonomy archive page also translates properly hidden link hidden link
However when clicking on the custom post type itself I get an error as the /%season%/ part of the custom url defined in the acf advanced tab for the CPT does not translate correctly. hidden link
and the error hidden link
instead of
hidden link
I have tried to translate the url - slug through:
WPML->settings-> slug translations (check)
WPML->settings->Post Types Translation->Traditions (traditions)->Set different slugs in different languages for Traditions->thrace/traditions/%season% (english original) -> thraki/dromena/%season% (greek translation)
I suspect the problem is that when translating custom taxonomy "Season" through WPML->Taxonomy translation there is no option for the slug.
Please help and if it is too complicated for me to explain here I would gladly give you access to this development site.
Thank you
That % based identifiers 'll not work for CPT and taxonomy translations, when translating through WPML (out of the box). I discussed with the team and found that the % implies that there is an additional logic that would replace the variable - and this may require custom coding (which is unfortunately out of the scope of this forum).
However, I recommend to translate each part separately instead of thrace/traditions/%season% (a / based long path + % based notation). For example, CPT's slug thrace -> thraki, taxonomy's slug traditions -> dromena and child term autumn -> fthinoporo.
You can translate each taxonomy term accordingly, please see these guides for details:
Translating the slugs without custom slugs defeats the whole purpose of the desired structure becausa that way custom taxonomies have different paths than CPTs.
Sorry if I didn't make it very clear. I will try to define everything more precisly so you could get a better idea of what I am trying to achieve: hidden link = page hidden link = subpage hidden link = custom taxonomy "season" hidden link = custom post type "tradition"
I have achieved this url structure by defining
ACF->Post Types->Traditions->Advanced settings->URLs->Permalink Rewrite=Custom Permalink + URL slug=thrace/traditions/%season%
ACF->Taxonomies->Seasons->Advanced settings->URLs->Permalink Rewrite=Custom Permalink + URL slug=thrace/traditions/
This allows to have the following structure:
home/page/subpage/custom taxonomy/cpt
(home/thrace/traditions/season/tradition)
Primary language works fine but I am having trouble with the slug translation. Is there some way to call the custom taxonomy and insert it into the slug without the %.
I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated.
Your next answer will be private, to share this information safely.
Also provide detailed steps to reproduce the issue and links to pages in admin and on frontend.
IMPORTANT: Please take a complete backup of the site to avoid data loss. I may need to activate/deactivate plugins also.
I looked into it again and this looks a bit complex to achieve. However, I am not giving up until I am very sure. I have to discuss this again with my team and 'll get back to you accordingly.
Thank you Waqas for your persistance. I will be waiting to hearing from you. Hopefully with some good news. Other than that with the help of the Rankmath team I have been able to translate (through hard code snippets) their breadcrumb function so everything looks perfect except for this slug mishap.
I discussed the matter and it turns out that unlike standard permalink tags (i.e. %postname%, %category%, %post_id% and etc), the %season% is a custom permalink tag. Thus it needs to be incorporate and be handled using custom code.
Unfortunately, custom coding is out of scope of this forum. However, I found some example which you can use to register your %season% in WordPress and achieve the purpose. Please see the following articles:
I have also found out that this is a complicated issue as is the pagination slug translation. Anyway, I will read through your suggestions and try to achieve the desired result. Thank toy for your time and effort.