uweb / uw_wp_theme

The University of Washington WordPress Theme
23 stars 5 forks source link

Minor php 8 issue with Widget visibility #77

Open bjvogt opened 9 months ago

bjvogt commented 9 months ago

Problem with php 8.2 in the /inc/widgets/class.widget-visibility.php script.

Line 440 reads: else if ( is_singular() && $terms & !is_wp_error( $terms ) ) A fix: else if ( is_singular() && $terms && !is_wp_error( $terms ) )

Additionally, a warning is thrown on line 435: $terms = get_the_terms( $post->ID, $rule['minor'] ); // Does post have terms in taxonomy?

I'm just suppressing with @ but there is probably a more elegant solution.
$terms = @get_the_terms( $post->ID, $rule['minor'] ); // Does post have terms in taxonomy?

bjvogt commented 8 months ago

in php 8.3 I ended up commenting out line 435 altogether to resolve a fatal error... if I discover any negative impact of that change I'll add another comment.