Skip to content

Commit

Permalink
Fix exists checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Aug 18, 2024
1 parent 32d62a7 commit 9357c2d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions classes/PodsRESTHandlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ public static function get_pods_object( $pod_name, $id ) {
self::$pods = pods_get_instance( $pod_name, $id, true );
}

if ( self::$pods && (int) self::$pods->id !== (int) $id ) {
self::$pods->fetch( $id );
}
if ( self::$pods ) {
if ( (int) self::$pods->id !== (int) $id ) {
self::$pods->fetch( $id );
}

if ( ! self::$pods->exists() ) {
return false;
if ( ! self::$pods->exists() ) {
return false;
}
}

return self::$pods;
Expand Down

0 comments on commit 9357c2d

Please sign in to comment.