) : self::FILTER_BY; $post_type_key = $is_prefixed ? $this->get_query_property_name( self::POST_TYPE ) : self::POST_TYPE; $conditions = [ 'relation' => 'and', 'terms' => $this->get_related_tags_conditions( $post_type_key, '!==' ), ]; if ( $should_add_hierarchy_condition ) { $conditions['terms'][] = Utils::format_control_condition( $filter_by_key, '!==', self::MANUAL_SELECTION ); } $conditions['terms'] = array_merge( $conditions['terms'], $extra_terms ); return $conditions; } private function get_related_tags_conditions( $name, $operator, $extra_terms = [] ) { $tags = [ self::POST_TAG_TAXONOMY, self::PRODUCT_TAG_TAXONOMY ]; return $this->get_related_taxonomy_condition_terms( $tags, $name, $operator, $extra_terms ); } private function get_related_taxonomy_condition_terms( $value_options, $name, $operator, $extra_terms = [] ) { $terms = []; foreach ( $value_options as $value ) { $terms[] = Utils::format_control_condition( $name, $operator, $value ); } return array_merge( $terms, $extra_terms ); } public static function is_loop_taxonomy(): bool { global $wp_query; return $wp_query->is_loop_taxonomy ?? false; } public static function is_loop_taxonomy_strict(): bool { global $wp_query; return self::is_loop_taxonomy() && ( $wp_query->loop_term ?? false ); } private static function get_post_additional_cpts() { $post_types = get_post_types( [ 'public' => true, '_builtin' => false, ] ); return array_filter( $post_types, function( $post_type ) { return ! in_array( $post_type, [ 'product', 'e-landing-page', 'elementor_library' ] ); } ); } }