I got some problems during my loading priority/order that i already discovered. Now i ran into the problem that i can't use any post_thumbnail functions (get_post_thumbnail_id, has_post_thumbnail, the_post_thumbnail): "Call to undefined function"...

Does anyone know at which point these functions are loaded? I would be satisfied if i know after which hook they get loaded.


Edit: I traced down all files that get loaded on my edit custom post type edit screen. It's 64 file from core before my theme files start loading. Files starting from #26 are:

  • /wp-includes/general-template.php
  • /wp-includes/link-template.php
  • /wp-includes/author-template.php
  • /wp-includes/post.php
  • /wp-includes/post-template.php
  • /wp-includes/category.php
  • /wp-includes/category-template.php ... but /wp-includes/post-thumbnail-template.php doesn't seem to load. Weired ...

Edit 2: post thumbnail support is activated and i can upload images. Only when i try to view them then i get the error about the id function. My problem is that it worked an hour ago and i need to track down whatever is causing this behavior.

Edit 3: Funny. I load my files at init.. right after the file should get included. Plus: I just downloaded wordpress again and replaced the file, so everything from this side should be fine.

1 Answer 1


These are included in wp-settings.php right after after_setup_theme hook and so should be available starting with init hook.

Also check if you have add_theme_support( 'post-thumbnails' ); declared in your theme, otherwise these functions won't be included at all.

  • Thansk for your answer. You're right. I guess i got some pretty heavy problems. Luckily i'm at v0.7.x and won't release before v1.0 ;)
    – kaiser
    Commented Jan 13, 2011 at 8:10
  • I'm such a [insert term here]* !! I rewrote my init routine to include all files from my child themes opt-folder and completely forgot/oversaw that i included them a second time via a function, that adds the theme support on the 'init'-hook during my try to find out why it doesn't work. But without knowing post-thumbnail-template.php won't load... I just deleted the line and now everything works out fine on 'after-theme-setup'-hook. *P.s. No, don't even think about a term ;)
    – kaiser
    Commented Jan 13, 2011 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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