Two key things to add to a WordPress theme are the wp_head and wp_footer functions. These two functions are known as “action hooks”. Depending on how much you know about theme development, action hooks may be easy or difficult to understand. Action hooks are placeholders where code is dynamically added to a theme.
To add the wp_head function correctly to your WordPress theme, simply open your theme’s header.php file and add the following line of PHP code right before the closing head tag (</head>):
To correctly add the wp_footer function to your WordPress theme, open the theme’s footer.php file and add the following line of PHP code before the closing </body> tag:
You may find that a WordPress plugin isn’t working on your website. Maybe the plugin worked at one point, but then you updated either the plugin or WordPress and it stopped working. Maybe the plugin never worked at all. If you do find that you are having trouble with a plugin, your first step should be to make sure that you have wp_head and wp_footer correctly placed in your template.
Action hooks like wp_head and wp_footer are essential to how plugins interact with your WordPress theme. In the past these funtions were not always needed, so if you have a theme that hasn’t been updated in a while, it would be a good idea to add these action hooks to protect your theme from some future problems.