'is', 'NOT IN' => 'is not', ]; } public function get_options() { $categories = get_categories( [ 'hide_empty' => false ] ); $options = []; foreach ( $categories as $cat ) { $options[ $cat->term_id ] = $cat->name; } return $options; } public function check( $operator, $value ) { if ( ! is_single() && ! is_category() ) { return false; } // $value should be an array of IDs if ( ! is_array( $value ) ) { $value = [ $value ]; } if ( $operator === 'IN' ) { return has_category( $value ); } else { return ! has_category( $value ); } } }