post_type === 'post' && $screen->taxonomy === 'acf-field-group-category'; } if(in_array($screen->post_type, $post_types) || $is_category){ return true; } } } return false; } /** * acfe_match_location_rules * * Match screen data against an array of location * * @param $location * @param $screen * * @return bool */ function acfe_match_location_rules($location, $screen){ // Loop through location groups. foreach($location as $group){ // ignore group if no rules. if(empty($group)){ continue; } // Loop over rules and determine if all rules match. $match_group = true; foreach($group as $rule){ if(!acf_match_location_rule($rule, $screen, array())){ $match_group = false; break; } } // Show the field group if($match_group){ return true; } } return false; } /** * acfe_is_dynamic_preview * * Check if currently in ACFE FlexibleContent Preview or ACF Block Type Preview * * @return bool */ function acfe_is_dynamic_preview(){ // vars global $is_preview; $return = false; // flexible content if(isset($is_preview) && $is_preview){ $return = true; // block type }elseif(wp_doing_ajax() && acf_maybe_get_POST('query')){ $query = acf_maybe_get_POST('query'); if(acfe_get($query, 'preview')){ $return = true; } } return apply_filters('acfe/is_preview', $return); } /** * acfe_is_block_editor * * An enhanced version of acf_is_block_editor that also check if currently in a block type * * @return bool */ function acfe_is_block_editor(){ // check block editor screen or ajax fetch (block edit mode) return acf_is_block_editor() || acf_maybe_get_POST('action') === 'acf/ajax/fetch-block'; } /** * acfe_is_gutenberg * * Check if current screen is block editor * * @return bool * @deprecated */ function acfe_is_gutenberg(){ return acfe_is_block_editor(); }