Display Code on Your WordPress Site

From the editor select Text option and wrap your code with the “code” tag of html.