First of all note that get_template_part
internally uses locate_template
, so your feeling that the latter is slower is wrong.
If you look at the code, get_template_part
is little more than a wrapper for locate_template
, so if one work and the other not, there are 2 possibilities:
- you are using
get_template_part
wrong - there’s some hook on
"get_template_part_{$slug}"
action that prevent it works
However, if locate_template
works, use it: it’s not slower, to be honest it can be pretty faster if there are functions hooked on "get_template_part_{$slug}"
that slow down execution.