Adding code snippets to your theme’s functions.php file
Theme Functions (functions.php) is the main file to add your custom code (in PHP language) to customize and/or change the behavior of the theme or any plugin.
To add your code to functions.php go to:
- WP Admin
- Appearance
- Theme Editor
- Select the Theme Functions (functions.php) file from the sidebar on the right.
- Add in your code at the bottom of the page (before the PHP closing tag
?>
if this is present) - Click Save Changes
If you cannot see the Theme Editor menu item, it is probably disabled by a security plugin or by your hosting provider. You can try using a plugin for adding code snippets.