Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This question specifically deals with the Multiple Post Thumbnails plugin, though the problem may have to do with my installation of WP itself as nobody else seems to have had this problem.

I am using WP 3.0.5, completely stock with the exception of the plugin. As per the instructions, I am initializing the plugin as such:

$video_thumb_secondary = new MultiPostThumbnails(array(
        'label' => 'Thumbnail Image',
        'id' => 'video-thumbnail',
        'post_type' => 'video'
));

The code above is called in a function run during the admin_menu hook.

When attempting to upload/select an image and then clicking on 'Use as thumbnail image' I get the following error: "Could not set that as the thumbnail image. Try a different attachment." I have also tried initializing the plugin with the default 'post_type' of 'post' and have run into the same error.

As I said, I have seen no other documented cases of this error with this plugin, and hardly any at all of this error in general with WP. Hoping somebody can shed some light on it...

** EDIT ** Resolved my own issue. The code above must be run outside of any function in your functions.php file. I naturally assumed that it should be defined in one of the admin menu hooks, but that is not the case.

share|improve this question
add comment

1 Answer

You should trigger the function on some other hook like

function add_multiple_post_thumbnails_from_plugin() {  
  new MultiPostThumbnails( array(  
         'label'     => 'Thumbnail Image' 
        ,'id'        => 'video-thumbnail'
        ,'post_type' => 'video'  
  ) );  
}  
add_action( 'admin_init', 'add_multiple_post_thumbnails_from_plugin' );
share|improve this answer
    
You sent me in the right direction in any case @kaiser. Edited my original post with solution. –  Mike Feb 20 '11 at 21:59
    
you should anyway add this as separate answer and later check it as solution. this belongs to your acceptance rating over here (100% is good). btw: upvoting of my post is always appreciated :) –  kaiser Feb 21 '11 at 18:59
    
Thanks Kaiser, is it just me or this plugin only allows 2 thumbnails? –  Zeal Jun 3 '11 at 8:38
    
@Zeal I don't know the Plugin. –  kaiser Jun 4 '11 at 18:15
add comment

Your Answer

 
discard

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.