From f90e8371ece6976c2f4d56e4cdfbbdbb3b0ac348 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Wed, 16 Nov 2022 09:50:10 -0300 Subject: [PATCH] Update the list of post types ignored by Protected Content --- .../ProtectedContent/ProtectedContent.php | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/includes/classes/Feature/ProtectedContent/ProtectedContent.php b/includes/classes/Feature/ProtectedContent/ProtectedContent.php index 1be4c2581e..d64eff78c8 100644 --- a/includes/classes/Feature/ProtectedContent/ProtectedContent.php +++ b/includes/classes/Feature/ProtectedContent/ProtectedContent.php @@ -81,33 +81,26 @@ public function post_types( $post_types ) { // Let's get non public post types first $pc_post_types = get_post_types( array( 'public' => false ) ); - // We don't want to deal with nav menus - if ( $pc_post_types['nav_menu_item'] ) { - unset( $pc_post_types['nav_menu_item'] ); - } - - if ( ! empty( $pc_post_types['revision'] ) ) { - unset( $pc_post_types['revision'] ); - } - - if ( ! empty( $pc_post_types['custom_css'] ) ) { - unset( $pc_post_types['custom_css'] ); - } - - if ( ! empty( $pc_post_types['customize_changeset'] ) ) { - unset( $pc_post_types['customize_changeset'] ); - } - - if ( ! empty( $pc_post_types['oembed_cache'] ) ) { - unset( $pc_post_types['oembed_cache'] ); - } - - if ( ! empty( $pc_post_types['wp_block'] ) ) { - unset( $pc_post_types['wp_block'] ); - } + $ignored_post_types = [ + 'custom_css', + 'customize_changeset', + 'ep-synonym', + 'ep-pointer', + 'nav_menu_item', + 'oembed_cache', + 'revision', + 'user_request', + 'wp_block', + 'wp_global_styles', + 'wp_navigation', + 'wp_template', + 'wp_template_part', + ]; - if ( ! empty( $pc_post_types['user_request'] ) ) { - unset( $pc_post_types['user_request'] ); + foreach ( $ignored_post_types as $ignored_post_type ) { + if ( $pc_post_types[ $ignored_post_type ] ) { + unset( $pc_post_types[ $ignored_post_type ] ); + } } // By default, attachments are not indexed, we have to make sure they are included (Could already be included by documents feature).