WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
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 Jan 13 '11 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 Jan 13 '11 at 10:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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