Since Discourse introduced a wysiwyg editor, adding code blocks messes up the posts. Last time I checked if there’s an option to override this default behavior forum wide, there wasn’t one.
But every user has an option on the top left of the editor to switch back to markdown (which I strongly suggest, especially if you’re using code blocks):
