Restrict viewing of posts by category, user role

Turns out the issue with my category was that it was a custom taxonomy:

elseif ( is_tax('category', $private_categories) )

needed to be

elseif ( is_tax('wzkb_category', $private_categories) )

Super simple but might send someone down the correct path in future.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)