Any advantage to using get_header() over include(‘header.php’)?

Using generic function means throwing out layer of WP API:

  • get_header hook would be gone;
  • compatibility with fetching different headers by name ("header-{$name}.php") would be gone;
  • usage of locate_template() would be gone, which likely would destroy compatibility with child themes.

You can always look at source to see what exactly function does.

WordPress uses own function not just-because. It is usually for concrete compatibility or functionality reasons.

Leave a Comment