# Make Custom Post Types Translatable in Polylang

> Turns on Polylang translation for custom post types registered by your theme or a plugin, even when they do not appear in Languages > Settings.

- Type: PHP
- Runs: Run everywhere
- Category: [Multilingual](https://wpide.com/library/category/multilingual/)
- Tags: polylang, post-types, translations
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/pll-translatable-post-types/

## Code

```php
$wpide_types = array( 'book', 'portfolio' ); // Post type keys.

add_filter( 'pll_get_post_types', function ( $post_types, $is_settings ) use ( $wpide_types ) {
    foreach ( $wpide_types as $type ) {
        if ( $is_settings ) {
            unset( $post_types[ $type ] ); // Managed here, so hide it from the settings list.
        } else {
            $post_types[ $type ] = $type;
        }
    }

    return $post_types;
}, 10, 2 );
```

## Notes

Use the post type keys (e.g. book, portfolio). They disappear from Polylang's settings list because this snippet now manages them.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Make Custom Post Types Translatable in Polylang" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
