From f79c0c6424c808fb830733bfd0a886d0bd33b810 Mon Sep 17 00:00:00 2001 From: raikasdev Date: Tue, 26 Sep 2023 09:08:42 +0300 Subject: [PATCH 1/2] Cleaned up ACF Block load script --- inc/template-tags/acf-blocks.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/template-tags/acf-blocks.php b/inc/template-tags/acf-blocks.php index e79fe346..de46090f 100644 --- a/inc/template-tags/acf-blocks.php +++ b/inc/template-tags/acf-blocks.php @@ -80,7 +80,11 @@ function load_acf_block( $block_path, $cache = false, $block = [], $is_preview = */ if ( ! $is_preview ) { $post_type = get_post_type(); - if ( $post_type && 'wp_block' !== $post_type && is_array( $block['post_types'] ) && ! in_array( $post_type, $block['post_types'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict + + $is_not_wp_block = $post_type && 'wp_block' !== $post_type; + $is_disallowed_in_post_type = is_array( $block['post_types'] ) && ! in_array( $post_type, $block['post_types'] ); + + if ( $is_not_wp_block && $is_disallowed_in_post_type ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict return ''; } } From 812334ae1651af85dfcf1b53da48def9cba2e649 Mon Sep 17 00:00:00 2001 From: raikasdev Date: Tue, 26 Sep 2023 09:13:02 +0300 Subject: [PATCH 2/2] Removed PHPCS disable comment --- inc/template-tags/acf-blocks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/template-tags/acf-blocks.php b/inc/template-tags/acf-blocks.php index de46090f..1fdda46b 100644 --- a/inc/template-tags/acf-blocks.php +++ b/inc/template-tags/acf-blocks.php @@ -84,7 +84,7 @@ function load_acf_block( $block_path, $cache = false, $block = [], $is_preview = $is_not_wp_block = $post_type && 'wp_block' !== $post_type; $is_disallowed_in_post_type = is_array( $block['post_types'] ) && ! in_array( $post_type, $block['post_types'] ); - if ( $is_not_wp_block && $is_disallowed_in_post_type ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict + if ( $is_not_wp_block && $is_disallowed_in_post_type ) { return ''; } }