I wouldn't recommend letting a tool decide what your IO is supposed to be.
-- output data, driven active when \WR is LOW, high-Z otherwise
d <= d_out WHEN wr_en_n = '0' ELSE (others => 'Z');
-- input data
d_in <= d;
Just don't bury the logic in some deeply nested if/else tree tree in a process or state machine, this is likely to not synthetize to what you had intended. :-).