• Kris Kelvin

    (@kanlukasz)


    I saw a lot of questions about including custom views in WordPress (I mean custom templates). There were many answers. Some people recommend using template_include and others recommend using type_template

    My question is, which is better for working with custom templates? What are the pros and cons of both solutions?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    “template_include” is the last filter to fire before WP actually includes the template file, so filter callbacks here have the final say in what file is used. I always use this filter to override what WP wants to do. I’m not too familiar with “type_template”, it fires earlier and WP still has the opportunity to decide what file in the path should be used, if I’m reading it correctly.

Viewing 1 replies (of 1 total)
  • The topic ‘For custom templates, is it better to use `template_include` or `type_template`?’ is closed to new replies.