From 264aaa2270b22a4ab03d5e6d78ec5a747ea77f47 Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Wed, 11 Mar 2020 08:29:45 -0600 Subject: [PATCH] feat: remove resources from Polylang --- includes/functions/core.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/includes/functions/core.php b/includes/functions/core.php index 130706d..5133efd 100644 --- a/includes/functions/core.php +++ b/includes/functions/core.php @@ -41,8 +41,8 @@ function setup() { add_filter( 'mce_css', $n( 'mce_css' ) ); // Hook to allow async or defer on asset loading. add_filter( 'script_loader_tag', $n( 'script_loader_tag' ), 10, 2 ); - // Ensure resources and topics are translatable. - add_filter( 'pll_get_post_types', $n( 'add_resource_to_pll' ), 10, 2 ); // TODO: Remove this. + // Ensure taxonomies are translatable. + add_filter( 'pll_get_post_types', $n( 'remove_resource_from_pll' ), 10, 2 ); add_filter( 'pll_get_taxonomies', $n( 'add_coop_type_to_pll' ), 10, 2 ); add_filter( 'pll_get_taxonomies', $n( 'add_sector_to_pll' ), 10, 2 ); add_filter( 'pll_get_taxonomies', $n( 'add_region_to_pll' ), 10, 2 ); @@ -144,19 +144,15 @@ function resource_init() { } /** - * Add the `lc_resource` post type to Polylang, ensuring it is translatable. + * Remove the `lc_resource` post type from Polylang. * * @param array $post_types An array of post types. * @param bool $is_settings Whether or not we are on the settings page. * * @return array */ -function add_resource_to_pll( $post_types, $is_settings ) { - if ( $is_settings ) { - unset( $post_types['lc_resource'] ); - } else { - $post_types['lc_resource'] = 'lc_resource'; - } +function remove_resource_from_pll( $post_types, $is_settings ) { + unset( $post_types['lc_resource'] ); return $post_types; }