Polylang non translatable custom taxonomy

Polylang plugin documentation talks about non translatable custom taxonomy. I'm using the plugin Media Libray Assis

Polylang plugin documentation talks about non translatable custom taxonomy. I'm using the plugin Media Libray Assistant, which creates a custom media taxonomy named "attachment category". I woud like the terms of such taxonomy to be non translatable, but by default they are.

Is it possible to tell to Polylang (maybe programmatically) that a certain taxonomy does not need a language specification?

Thanks in advance for your attention.

Polylang plugin documentation talks about non translatable custom taxonomy. I'm using the plugin Media Libray Assistant, which creates a custom media taxonomy named "attachment category". I woud like the terms of such taxonomy to be non translatable, but by default they are.

Is it possible to tell to Polylang (maybe programmatically) that a certain taxonomy does not need a language specification?

Thanks in advance for your attention.

Share Improve this question edited May 7, 2018 at 9:02 mmj asked May 6, 2018 at 14:29 mmjmmj 1137 bronze badges 2
  • when you go in the backend "Languages" -> "Settings", you can choose toxonomies in "Custom post types and Taxonomies". it's this setting you was searching for ? – mmm Commented May 7, 2018 at 5:28
  • @mmm Unfortunately for some reason (a bug?) the "attachment category" taxonomy created by plugin Media Library Assistant is not listed there, that also why I asked help. – mmj Commented May 7, 2018 at 9:02
Add a comment  | 

2 Answers 2

Reset to default 1

Use the following hook and replace custom_tax with your taxonomy slug

add_filter( 'pll_get_taxonomies', 'add_tax_to_pll', 10, 2 );
 
function add_tax_to_pll( $taxonomies, $is_settings ) {
    if ( $is_settings ) {
        unset( $taxonomies['custom_tax'] );
    } else {
        $taxonomies['custom_tax'] = 'custom_tax';
    }
    return $taxonomies;
}

It seems that the plugin Media Library Assistant is deliberately setting its custom taxonomy category_attachment as translatable by means of configuration file wpml-config.xml. Therefore changing the line

<taxonomy translate="1">attachment_category</taxonomy>

to

<taxonomy translate="0">attachment_category</taxonomy>

should do the trick. However I did not try myself because I'm not sure of what happens to existing taxonomy terms having a language specification.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744339499a4569318.html

相关推荐

  • Polylang non translatable custom taxonomy

    Polylang plugin documentation talks about non translatable custom taxonomy. I'm using the plugin Media Libray Assis

    7天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信