Skip to content

Instantly share code, notes, and snippets.

@icetee
Last active November 28, 2018 00:35
Show Gist options
  • Save icetee/3739c535e9f440b3b378 to your computer and use it in GitHub Desktop.
Save icetee/3739c535e9f440b3b378 to your computer and use it in GitHub Desktop.
WordPress Polylang Add Custom Types
add_filter('pll_get_post_types', 'my_pll_get_post_types');
function my_pll_get_post_types($types) {
return array_merge($types, array('portfolio' => 'portfolio'));
}
@dvdmi
Copy link

dvdmi commented Dec 8, 2017

To remove certain post types and only use the post and page types to disallow Polylang to process these as multilanguage in case of portfolio items:
return array_splice($types, 0, 2); or to be safe and return known values: return array( array('page' => 'page') );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment