Created
March 13, 2013 21:02
-
-
Save attitude/5156173 to your computer and use it in GitHub Desktop.
Patch for possible fix for issue #1049 of Pods Framework.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/classes/PodsAPI.php b/classes/PodsAPI.php | |
index 129badf..571bd1a 100644 | |
--- a/classes/PodsAPI.php | |
+++ b/classes/PodsAPI.php | |
@@ -3020,9 +3020,7 @@ class PodsAPI { | |
if ( !empty( $related_ids ) ) { | |
update_metadata( $object_type, $id, '_pods_' . $related_field[ 'name' ], $related_ids ); | |
- foreach ( $related_ids as $rel_id ) { | |
- add_metadata( $object_type, $id, $related_field[ 'name' ], $rel_id ); | |
- } | |
+ add_metadata( $object_type, $id, $related_field[ 'name' ], $related_ids ); | |
} | |
else | |
delete_metadata( $object_type, $id, '_pods_' . $related_field[ 'name' ] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We add individual meta records for each ID because it makes WP_Query meta_query lookups and our (advanced) JOINs more efficient. As this happens only when you update the item, it's not expensive to do it the right way as I believe we're doing right now.