Reputation: 167
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
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
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