• I’m the developer of the WP Store Locator plugin and a user pointed out to me that the custom post type / taxonomy isn’t recognized in Polylang.

    They don’t show up on the Settings -> Custom post types and Taxonomies page.

    Any idea how I could fix this?

    • This topic was modified 4 years, 11 months ago by Tijmen Smit.
Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)

The topic ‘Polylang doesn’t recognize WP Store Locator post type / taxonomy’ is closed to new replies.