Skip to content

Instantly share code, notes, and snippets.

View martinellimarco's full-sized avatar

Marco Martinelli martinellimarco

View GitHub Profile
@martinellimarco
martinellimarco / FilteringCPT.patch
Created December 16, 2023 13:59
FIX: WP All Export - slow export when using OR filters on postmeta (custom fields)
--- src/Pro/Filtering/FilteringCPT.php 2023-12-16 13:44:38.817294704 +0000
+++ src/Pro/Filtering/FilteringCPT.php 2023-12-16 13:44:19.792826943 +0000
@@ -211,8 +211,8 @@
self::$variationWhere = $this->queryWhere;
}
- $joinString = " INNER JOIN {$this->wpdb->postmeta} AS $table_alias ON ({$this->wpdb->posts}.ID = $table_alias.post_id) ";
- $whereString = "$table_alias.meta_key = '$meta_key' AND $table_alias.meta_value " . $this->parse_condition($rule, false, $table_alias);
+ $joinString = " INNER JOIN {$this->wpdb->postmeta} AS $table_alias ON ({$this->wpdb->posts}.ID = $table_alias.post_id AND $table_alias.meta_key = '$meta_key') ";
+ $whereString = "$table_alias.meta_value " . $this->parse_condition($rule, false, $table_alias);