Last active
November 28, 2018 00:35
-
-
Save icetee/3739c535e9f440b3b378 to your computer and use it in GitHub Desktop.
WordPress Polylang Add Custom Types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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') );