Adding custom fonts (local) to WordPress?

I assume you have put the code somewhere in your current theme. The child theme avoids to lose your editing after theme updates. It is really much easier than it seems.

If you want to understand why your font isn’t loaded, you can look for 404 errors in your console log or try with the plugin Query Monitor, which show you all the fonts paths used in the current page.

Still, if you are not confident with loading your font programmatically and use a child theme, or for any other reason you want avoid that, then a plugin might be a solution for you. Use Any Font would does the job in this case.