Skip to content

Commit

Permalink
Fix PHP 8+ fatal error on in_array if variable is not array
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykervran committed Nov 28, 2023
1 parent ed99308 commit 8ad2cb6
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( $taxonomy ) && $taxonomy === $sync->taxonomies ) {
return $sync;
}

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

0 comments on commit 8ad2cb6

Please sign in to comment.