Skip to content

Commit

Permalink
Merge pull request #199 from raikasdev/fix/improve-load-acf-block
Browse files Browse the repository at this point in the history
Cleaned up ACF Block load script if expression
  • Loading branch information
ronilaukkarinen authored Dec 8, 2023
2 parents 3d85d70 + 812334a commit 58c0c90
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion inc/template-tags/acf-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
return '';
}
}
Expand Down

0 comments on commit 58c0c90

Please sign in to comment.