Plugin Author
Chouby
(@chouby)
Hello,
We display only **public** post types and taxonomies. See https://github.com/polylang/polylang/blob/3.1-beta1/settings/settings-cpt.php#L64
The reasoning is that, when a post type or taxonomy, is not made public, there is certainly a good reason. We expect that there is an increased risk to do someting wrong if a user with no development knowledge activates the translation for such post types or taxonomies.
As a developer, you have several ways to change this.
If you believe that the post types must always be translatable, you can tell it to Polylang (and to WPML the same way) by adding a wpml-config.xml file. See: https://polylang.pro/doc/the-wpml-config-xml-file/. Note that in such case, the post types and taxonomies still won’t appear in the Polylang settings. We expect that your choice is the correct one and that a user should not override it.
If you prefer to let your users choose whether to translate your post type or not, you can use the filter pll_get_post_types as follows:
add_filter(
'pll_get_post_types',
function( $post_types, $is_settings ) {
if ( $is_settings ) {
$post_types['mycpt'] = 'mycpt';
}
return $post_types;
},
10,
2
);
The same for taxononomies.