mcleodm3
mcleodm3

Reputation: 167

'Undefined function' in fresh WordPress install?

I've been having a problem with my media browser for weeks and haven't been able to solve it. When browsing to insert an image, the media library shows absolutely nothing, just blank white. I see tabs telling me that it sees the objects in the library, but they do not display as thumbnails to select.

For some reason it just occurred to me (a-doy) to look at my server logs - turns out my ISP has been suppressing PHP errors. The error I'm getting is this:

PHP Fatal error: Call to undefined function get_post_thumbnail_id() in REDACTED/wp-admin/includes/media.php on line 1292, referer: http://REDACTED/wp-admin/media-upload.php?post_id=877&type=image&

Now this is baffling - I did a completely fresh install of WordPress to try and solve this problem, and yet I'm still getting an "undefined function" error. Why is this happening, and how can I fix it?

Any help is greatly appreciated. Thank you!

Upvotes: 0

Views: 1567

Answers (2)

Dan Gayle
Dan Gayle

Reputation: 2357

Make sure that your add_theme_support('post-thumbnails') function is run before init. I know this has screwed me up when I had it in a hook tied into init.

If it has to be hooked in, it should be hooked into after_setup_theme

Upvotes: 0

Corey
Corey

Reputation: 6822

It looks as if you have to initialize theme support before get_post_thumbnail_id() can be used.

<?php add_theme_support('post-thumbnails'); ?>

http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails

Upvotes: 2

Related Questions