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_partwrong - 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.
Related Posts:
- Is there any way to use get_template_part() with folders?
- Is it possible to override the result of get_template_part()?
- Templates & CSS – Proper Programming Practice?
- TwentyTen: Overloading template.php files vs. get_template_part
- Passing variables to template parts
- How to move style from template file to section?
- Unable to include a template
- Where is the template for the ‘standard’ format of a post in the theme twentythirteen?
- Valid HTML in Template Part
- Remove portion of header code from home page only
- Use a separate template for the home page only
- How to create new template page and template-parts in wordpress theme [closed]
- Including template pages within another template?
- Organize template parts and page templates in folders in regards of template hierarchy
- How to get all template files used for rendering a single post/page?
- get_template_part for template in subdirectory not working
- Display a custom 404 page without a redirect
- How can I show contents of a template part inside of another page?
- When to use content-pagename.php?
- Is it possible to call a template file inside wysiwyg editor? And how?
- WordPress “Blog” template hierarchy
- How can i change email template for new user
- Enable page templates. How?
- Prevent comments_template() to load comments.php
- Page editor missing Templates drop down
- Custom templates folder
- Customizing get_the_excerpt() to specific length and “Read More” output.
- How to Rename a Template File?
- get page templates
- How to hide/redirect the author page
- Gutenberg & Pre-formatted Templates: Core Block Attributes
- Change site template from php
- Display HTML only if Custom Field has a Value
- Get templated page/post content via the WordPress API
- Force all images to full size in page template
- Login WordPress website using wp-rest api
- how to create template path for external (include) .js file
- Global variable set in the template’s header.php is unable to echo in footer.php
- How to Increment ID value within ACF Repeater Field Loop
- When a link doesn’t exist, how to tell WordPress what to do? (404 Error Page)
- WordPress Schema.org Markup. What value does it add?
- How to get_template_part using AJAX?
- home.php not loading
- get_search_link() redirects to 404 template page
- How to get the most recent modified date of anything in the footer of my site?
- New custom nev not working [closed]
- How do I insert JS tracking code to a page with the WP editor?
- LaTeX for WordPress strips codes in loop
- How to remove the Template drop down, but keep Parent and Order
- Search results when none found – stay on page they were on
- Include Lumen/Laravel app in custom WordPress template
- Rewrite Rules to custom template
- global variables in templates
- Unable to display pagination links on custom category template
- How do I override the search template in a plugin?
- How do I make a variable available inside partials?
- Is there any way to write custom HTML is some .php file and then call it wherever necessary?
- How to redirect my custom template page to content-none.php if no posts found?
- Get URL of current post but not the page number
- Is template name always same as directory name?
- Single Post Breadcrumb not linking back to Custom Post Type Index?
- Form post to WordPress page = wrong template
- get_month_link uses what wordpress template?
- Load custom script on a single template
- Archive template limiting to 4 entries?
- Author template help. How to check if field exists in the profile?
- Can you use block patterns in block templates or insert them programmatically?
- WP redirect to custom login page if a user is not logged in
- Change default template in the block editor (Gutenberg)
- How do I create post template for different taxonomy
- Ip2location plugin in my template header?
- Import a header template from another theme
- Will placing custom templates in sub directory break any native WordPress functionality
- Archive-custome_post.php template not working
- Change “posts per page” depending on width
- How to slice down index.php from a template and import from another file?
- Can index.php take over for front-page.php in template hierarchy on second page?
- What filter or action hook to use in order to load some code before the template begins printing in BuddyPress? [closed]
- How do I get tags linking to proper pages (/tag/sample-tag -> pages with that tag)
- How to name custom search page PHP file?
- Assign template to custom page type?
- Accidentally deleted code in header.php
- Custom post template
- Main content not displaying using custom page template
- plugin overwrites other plugin’s archive-.php file
- Creating custom URLs with template to fetch external JSON
- How can I display a list of pages and the template used by each?
- Templates for Mobile Site
- Where is search.php?
- Including Custom Template on template_include Filter not working
- Is it possible to return a specific tag archive/template as one of the search results?
- A page created with url of blog redirects to the posts page, how do I stop this?
- WordPress templates bug
- Taxonomy Parent not showing up in address bar
- wp e-commerce single-product template giving 404
- Strange Behavior of Page Template Dropdown
- WordPress Template works until page becomes a child
- WordPress -> PHPBB look a like
- How to limit block activity (insertion/deletion) to inside of a Block Template on the Admin Screen?
- get_template_parts() usage