@Japh Since the affiliate ID should always be a positive integer, I we should sanitized it this way:

```php
return ( defined( 'WP_STREAM_AFFILIATE_ID' ) && is_int( WP_STREAM_AFFILIATE_ID ) ) ? sprintf( '?ref=%d', absint( WP_STREAM_AFFILIATE_ID ) ) : null;
```