Introduction
If you’re building a WordPress.com site using the Intergalactic-2 theme and Elementor, you might run into an issue where the featured image does not appear on the frontend of single blog posts—even though it’s visible in the Elementor template preview.
In this blog, I’ll walk you through the issue I faced, what I discovered, and the custom code I used to resolve the problem.
The Problem
Let’s break down the situation:
- Theme: Intergalactic-2 (WordPress.com)
- Builder: Elementor
- Single Post Template: Created using Elementor, with a “Featured Image” widget or a dynamic Image widget using Post Featured Image
Issue Summary:
The featured image would display correctly in the Elementor template preview, but fail to display on the live frontend of the post.
This was particularly frustrating since the image was set correctly in the post editor and showed fine on the backend.
Investigation and Debugging
Here’s what I checked before finding the root cause:
- Featured image was correctly added in post editor
- Template was assigned and working properly
- Elementor’s dynamic image widget was configured correctly
- Post settings had no visibility or access restriction
- Theme functions weren’t visibly interfering
After logging metadata using get_post_meta(), I found that the _thumbnail_id meta key wasn’t being returned as expected on the frontend, likely due to a filter or override in WordPress.com’s environment.
The Solution: Add a Filter in functions.php
To fix the issue, I added the following code to the functions.php file:
add_filter( 'get_post_metadata', function( $value, $object_id, $meta_key, $single ) {
if ( $meta_key === '_thumbnail_id' ) {
error_log("🚨 Blocked get_post_meta for _thumbnail_id on Post ID: {$object_id}");
}
return null; // Let WordPress continue normally
}, 10, 4 );
What This Code Does:
- Hooks into the get_post_metadata filter.
- Checks if the requested meta key is _thumbnail_id (used for featured image).
- Returns null, which allows WordPress to proceed with its default behavior and fetch the correct image ID.
- Helps Elementor retrieve the correct featured image for rendering.
One Final Step
After adding the above code, I simply visited the post page again and the featured image appeared correctly on the frontend.
This confirmed that Elementor was not at fault—it was a metadata fetch conflict within WordPress or the theme.
Conclusion
This is a great reminder that even the simplest features like WordPress featured images can be affected by theme or platform-level filters.
If you’re:
- Using Intergalactic-2 on WordPress.com,
- Creating templates with Elementor, and
- Facing missing featured images on post pages.
Then adding the get_post_metadata filter above can quickly resolve the issue.