Trying to track down an error that's popping up in our php logs --

PHP Fatal error:  Call to undefined function get_template_part() in  ...index.php

It shows up 2-4 times a day (while index.php gets loaded dozens of times a minute). Even if we look locally, with no caching, we can't find what particular page or usage is firing this error.

I'm guessing that there's some particular pageload or something that's causing this... but I might be wrong.

Gurus! How do we track down what might be causing this? I'm looking for a repeatable Wordpress/php troubleshooting workflow, if possible.

  • Not sure but there would be some updates happening or CRON job is running on a certain interval. – WisdmLabs Jul 27 '15 at 10:49
  • Good thought. Will compare timestamps against cron. – indietravel Jul 27 '15 at 10:51
  • Intermitted issues are extremely hard to debug and I don't know of any means to track something like that except server error logs. The issue here is, is this coming from a specific request or any random request in general. I really don't know how to answer this or even what advice to give you, and I suppose almost all, if not all of us feel the same way. This is just way too localized and untestable and I would say almost unbuggable – Pieter Goosen Jul 27 '15 at 10:53
  • Thanks Pieter. I was hoping there might just be a workflow or testing method that I couldn't find on Google. Good to know I'm not the only person stumped by this kind of issue. – indietravel Jul 27 '15 at 16:55

The function in question is defined in general-template.php, which is loaded unconditionally in wp-settings.php. In other words it should be available in almost any WordPress core load (outside of very rare custom loading routines).

My educated guess would be is that some bot simply pings that index.php file directly, without going through WP URL and proper core load. You can likely confirm this by digging for those hits through your web server's access logs.

| improve this answer | |
  • Thanks Rarst. That was my thought too; but I'm unable to replicate this kind of visit. Wouldn't this be replicable by visiting example.com/index.php; or even path/to/dir/index.php directly? – indietravel Jul 28 '15 at 20:47
  • Yes. it should be. I'd scour the logs as per answer. – Rarst Jul 28 '15 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.