• Resolved crijken

    (@crijken)


    I chose Polylang because of the promise it could translate custom posttypes, but it only shows “products” as custom posttypes in Settings, not my own defined posttypes.

    Is it not possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter crijken

    (@crijken)

    Apparently, you need to add a filter:

    add_filter(‘pll_get_post_types’, ‘add_my_cpt_to_polylang’);

    function add_my_cpt_to_polylang($post_types) {

        $post_types[] = ‘certification’; // Replace with your CPT slug

        $post_types[] = ‘ingredient’; // Replace with your CPT slug    

        $post_types[] = ‘testimonial’; // Replace with your CPT slug    

        return $post_types;

    Plugin Author Chouby

    (@chouby)

    Hello,

    This is indeed a way. You can also use a wpml-config.xml file https://polylang.pro/documentation/support/developers/the-wpml-config-xml-file/.

    NB: By default, the CPT are displayed in the Polylang settings only if they are registered with public => true. Otherwise they are intentionally not displayed and you must declare them translatable programmatically as you did.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.