Where do I add my custom PHP code?
Last updated
Was this helpful?
Last updated
Was this helpful?
The best way to add your custom PHP code (small snippets) is in the functions.php
file of your child theme. The functions file behaves like a WordPress Plugin, adding features and functionality to a WordPress site through PHP code. You can use it to call native PHP functions, WordPress functions, or to define your own functions.
bakery-child
functions.php
Do not under any circumstance add PHP code in the functions.php
file of the parent theme! To keep your additions when you update the theme, always use the functions.php
file of your child theme.
Alternatively, simply use a "functionality" plugin such as the plugin to manage your custom PHP snippets.