Support

Account

Home Forums General Issues relation filter with category in wpml

Solved

relation filter with category in wpml

  • Hi guys,

    i use ACF 4.22 and WPML 2.81
    I have installed two languages english,german in WPML.
    If i use relation and select a category in ACF all posts from the selected category are shown in the post edit.
    But if i change the language there are no posts shown from the category in the post edit. I found out, that wpml works with different categorys in each languages. Can you help me?
    Regards gongl

  • Hi @gongl

    Thanks for the bug report.

    Perhaps each language has it’s of taxonomy terms (different term_id). This would cause ACF to not work…

    Is there some sort of WPML function called ‘get_translated_term_ID’ or something like that?

    If so, ACF could use this function to load int he ‘current language’ term_id.

    I see no issue with adding this to the core.

    Thanks
    E

  • Hi Elliot,

    I’m facing the same problem here. If you do not transalte ACF fields some rules are not available for every languages.

    Say you create a group with a rule set to the category “CatA” that exist in english and is translated as “CatA @fr” in french, the group will only appear on english posts set with the english category, not on french posts set with the translated category “CatA @fr”.

    I’ve fixed this for now by adding :

    if( defined('ICL_LANGUAGE_CODE') )
    {
    	$rule['value'] = icl_object_id($rule['value'], 'category');
    }

    in the function ‘rule_match_post_category’ on line 550 of the location.php file.

    I think it would be great for a rule set as “Category” to be applied on posts with translated category. It could also be done for rule set to a specific post or page.

    Thanks,
    Rodolphe

  • Hi @Rodolphe

    Thanks for the code. Looks great!

    Cheers
    E

  • Hi,
    I do have the same issue, the filters won’t appear for the translated category…I tried ‘rodolphe’ fix, but it didn’t work for, I simply can not see the translated categories with wpml, any idea how to fix it ?
    thank you

  • Hi @moabi

    I wonder if you are using the taxonomy ‘category’ or another type of taxonomy. Perhaps this is why the code does not work?

  • In fact i think it works…but NOT with the repeater field, I already had some issues with the plugin (pm me if you need more or an access maybe…)
    when the repeater doesn’t work, either it doesn’t show or it doesn’t record the fields, I have both cases…

  • Ok, I guess it is a wpml issue with the category translation…i’ll keep you informed, the translated categories won’t show up in the list,…

  • Hi elliot,
    I saw in the code you’re working on the wpml issue, any help needed ? any idea when you’ll be able to make it ?
    thank you

    nb : i’m still enable to get the fields in the translated categories, of course a quick workaround is to not specify the category…so it will show up everywhere..;but that is not really a cool solution, any other workaround for now ?

  • Hi @moabi

    I’m not sure what ‘code’ you are referring to. Can you point it out?

    Thanks
    E

  • I’m very sorry, in fact I just didn’t see the block on the right, to translate the fields..I do feel like an idiot right now…
    thank you, your work is really amazing…
    Best

Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘relation filter with category in wpml’ is closed to new replies.