Skip to content

Commit 83924f8

Browse files
authored
gpi-limit-by-field-value-match.php: Fixed issue with static DB prefix.
1 parent f10f675 commit 83924f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gp-inventory/gpi-limit-by-field-value-match.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
*/
88
// Update "123" to your form ID and "4" to your Inventory-enabled field ID.
99
add_filter( 'gpi_query_123_4', function ( $query ) {
10+
global $wpdb;
1011

1112
// Update "5" to the ID of the field you would like to match and "xyz" to the value you would like to match.
1213
$query['where'] .= ' AND em_by_field.meta_key = "5" AND em_by_field.meta_value = "xyx" ';
13-
$query['join'] .= ' INNER JOIN wp_gf_entry_meta em_by_field ON em_by_field.entry_id = em.entry_id ';
14+
$query['join'] .= " INNER JOIN {$wpdb->prefix}gf_entry_meta em_by_field ON em_by_field.entry_id = em.entry_id ";
1415

1516
return $query;
1617
} );

0 commit comments

Comments
 (0)