How can I add custom PHP / Javascript / CSS code?

If you want to to add some CSS pieces, some simple Javascript snippets (Analytics code for instance) or few PHP snippets, we highly recommend you to use a plugin. Here’s some recommendations:

  1. Code Snippets: This plugin allows you to add PHP, CSS, JS, HTML. They even have some predefined code presets you just need to choose from.
  2. Simple Custom CSS & JS: This plugin allows you to add CSS, JS.

With those plugins, you can edit CSS, JS, PHP.. from your WordPress backend. Your code won’t be lost even if you switch theme. Even I a WordPress developer myself, enjoy to use those plugins rather than developing a child theme.

Each plugin has its own docs so please check their docs for the detail instructions. Personally, I use Code Snippets plugin while they have few helpful snippets already to choose from. Also, they allow to add PHP code.