Include, Require, and Get_Template_Part in WordPress

One of the easiest mistakes to make as an early WordPress developer is understanding the difference in PHP’s include and require functions and WordPress’ built-in functions – such as get_template_part – for working with templates.

In my latest article on WPTuts+, I take a look at each of these functions.

Specifically, I take a look at the following:

  • include
  • include_once
  • require
  • require_once
  • get_template_part

I cover the definitions of each, the advantages and disadvantages of each, and how to properly include files with WordPress using get_template_part.

I also provide a few guidelines as to when it’s appropriate to use each function and my personal rules of thumb when working with each. I end the article with links to a few articles for further reading.

If this is a new topic to you, or you’ve always been curious about each, then be sure to read it and leave a comment!