Support » Plugin: Dynamic Content Gallery » Get thumbnail ID from postmeta table

  • Hi,

    I noticed that if you use image in your post that has been used in another page or post, WordPress will not create a separate record (with post_type = ‘attachment’) in the posts table again for the particular image. If you set the existing image in such case as featured image (manually or with some auto-featured-image plugin), WordPress will create record in the postmeta table with meta_key ‘_thumbnail_id’ but still no separate attachment record in the posts table.

    The Dynamic Content Gallery plugin however looks for attached images solely in the posts table and not in postmeta table.

    I fixed this by adding the following lines in the function dfcg_grab_post_image in includes/dfcg-gallery-core.php, after
    “$id = dfcg_get_image_id($parent_id, $args[‘num’]);” on line 463:

    if (!$id) {
    $id = get_post_meta($parent_id, “_thumbnail_id”, true);

    Hope this will help everyone who also hits this problem.

  • The topic ‘Get thumbnail ID from postmeta table’ is closed to new replies.