Skip to content

Commit

Permalink
Merge pull request #159 from BeAPI/fix/php8-fatal
Browse files Browse the repository at this point in the history
Fix PHP 8+ fatal error on in_array if variable is not array
  • Loading branch information
jeremykervran authored Nov 29, 2023
2 parents ed99308 + 0c626c1 commit 5322ec8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion classes/admin/admin-terms-metaboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ public static function taxonomy_has_sync( $taxonomy = '' ) {
}

foreach ( $syncs as $sync ) {
if ( in_array( $taxonomy, $sync->taxonomies ) ) {
if ( ! isset( $sync->taxonomies ) ) {
continue;
}

if ( is_string( $sync->taxonomies ) && $taxonomy === $sync->taxonomies ) {
return $sync;
}

if ( is_array( $sync->taxonomies ) && in_array( $taxonomy, $sync->taxonomies ) ) {
return $sync;
}
}
Expand Down

0 comments on commit 5322ec8

Please sign in to comment.