You may be interested in this article for ‘right’  - way to customize WordPress when working with custom code in your WordPress projects.
You may be interested in our article for the ‘right’ way to customize WordPress when working with custom code inside your WordPress projects.