Support » Plugin: Multiple Post Thumbnails » {$post_type}_{$id}_thumbnail_html filter using post ID instead of thumb ID

  • Resolved gordonbrander


    Hey, thanks for the helpful plugin. I found what I think is a small bug in the latest release: the filter in get_the_post_thumbnail() uses the post ID (global $id) as part of the filter key, rather than using the thumbnail ID.

    E.g., for a featured image that is registered to “post” and called “archive_image”, I would expect the following filter key:


    Instead, the filter key ends up being something like this:


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chris Scott


    Good catch. I’ve update it in trunk and will put it in the next release. Thanks!

    Plugin Author Chris Scott


    This has been updated to: {$post_type}_{$thumb_id}_thumbnail_html

    So, a thumbnail registered w/the id secondary-image for post post type would have a filter of post_secondary-image_thumbnail_html.

    Hah! Thanks both, for the question and the update. I thought this a couple of days ago, but was too unsure to call it a bug, because I’m new to WP development and just figured I didn’t know what I was doing! 🙂

    A semi-off-topic question:

    I’d like to get the caption for my secondary-image.

    I assume the best way to go about that is by doing something like this:

    $id = MultiPostThumbnails::get_post_thumbnail_id('investment', 'sidebar-chart');

    Then using that ID to do the following:

    $args = array(
    	'p' => $id,
    	'post_type' => 'attachment'
    $thumb_image = get_posts($args);
    $thumb_caption = $thumb_image->post_excerpt;

    The problem is that get_the_post_thumbnail_id isn’t returning a value to me.

    Any tips?


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘{$post_type}_{$id}_thumbnail_html filter using post ID instead of thumb ID’ is closed to new replies.