WordPress plugin · FacetWP family
FacetWP – Custom Hooks
Keep custom PHP code in its own plugin instead of your theme's functions.php file.
About This Plugin
FacetWP Custom Hooks is an add-on that gives you one place for custom PHP snippets. It is basically an empty PHP file in a plugin, so you add custom hooks without touching your theme.
Your custom code stays apart from theme code, so a theme switch or upgrade does not lose it. You can disable all customizations for testing by deactivating the plugin. If a mistake causes a PHP fatal error, WordPress disables the plugin and your site does not crash. This add-on never receives updates, so your code can not be overwritten.
Open Plugins, then Plugin File Editor, select Custom Hooks, paste your code into custom-hooks.php and click Update File. You can also paste the code into custom-hooks.php and upload it with FTP.