We have two different concepts that have similar names: -blocksonly and block-relay-only, and the similarity of names could lead to confusion. -blocksonly disables all local receiving & relaying of transactions (with a few exceptions), while block-relay-onlymeans that bitcoind will make 2 additional outbound connections that are only used for block relay.
In net.h and init.cpp, MAX_BLOCKS_ONLY_CONNECTIONS is used to represent the maximum number of block-relay-only outbound peers, which is 2. But this name sounds ambiguous, and I proposed a better name,  MAX_BLOCK_RELAY_ONLY_CONNECTION.