| @@ -64,9 +64,14 @@ | ||
| 64 | 64 | public function view_params() { |
| 65 | 65 | $parent_params = parent::view_params(); |
| 66 | 66 | $query_arg = $parent_params['terms_query_args']; |
| 67 | 67 | |
| 68 | - $term_count = count( get_terms( $query_arg ) ); | |
| 68 | + // get_terms() returns a WP_Error for an invalid taxonomy, and the taxonomy | |
| 69 | + // is a shortcode attribute the author controls — [betterdocs_category_box_3 | |
| 70 | + // taxonomy=nope] reached count(WP_Error), which is a TypeError on PHP 8 and | |
| 71 | + // takes the whole page down with a 500 for anonymous visitors. | |
| 72 | + $_terms = get_terms( $query_arg ); | |
| 73 | + $term_count = is_wp_error( $_terms ) ? 0 : count( $_terms ); | |
| 69 | 74 | $styles = ''; |
| 70 | 75 | |
| 71 | 76 | if ( $this->isset( 'column' ) ) { |
| 72 | 77 | $_c = intval( $this->attributes['column'] ); |