How to Control or Remove Featured Images in GeneratePress
Content
A common point of confusion for many users of the GeneratePress theme is the automatic display of featured images at the top of pages. This behavior often clashes with page builders like Elementor, where you might be designing a custom hero section, resulting in a duplicate image. Based on community discussions, this article explains why this happens and provides the most effective solutions.
Why Does This Happen?
This is not a bug but a default feature of the GeneratePress theme. For certain page templates, the theme is designed to automatically display the assigned featured image in a page header area. This is intended to provide a consistent and quick way to add a banner image to posts and pages. The conflict arises when users employ a page builder to manually create a header in the same location, leading to two images stacking on top of each other.
How to Remove the Automatic Featured Image
There are a few reliable methods to prevent the theme from displaying the featured image. The best method for you depends on your comfort level with code and your specific setup.
Method 1: Using a Simple PHP Snippet (Recommended)
The most common and effective solution is to add a small piece of code to your website. This code specifically targets the function that outputs the featured page header and removes it.
add_action('wp', function() {
remove_action( 'generate_after_header', 'generate_featured_page_header', 10 );
});
How to add this code: You should install a dedicated "Code Snippets" plugin (like the one aptly named 'Code Snippets') to safely add this PHP code to your site. Avoid adding it directly to your theme's `functions.php` file, especially if it's not a child theme, as your changes will be lost when the theme updates.
Method 2: Checking Your Page Template
Before adding code, check the template assigned to your page in the WordPress editor. Sometimes, selecting a different template (like "Elementor Full Width" or "No Header") can control the display of certain theme elements, including the featured image header. The availability of these templates can vary.
Method 3: Using Custom CSS (For Specific Cases)
If you only need to hide the image visually (it will still load in the background), you can use CSS. Inspect the element on your page to find its exact class or ID, then use code similar to the following in Appearance > Customize > Additional CSS:
.page-header-image {
display: none;
}
Troubleshooting Other Image Issues
The sample threads reveal other related image issues:
- Image Sizes: GeneratePress uses the 'full' image size for its page header by default. To change this, you would need to use the `generate_page_header_default_size` filter in your child theme's `functions.php` file.
- Image Clickability: If images in a post grid are not linked, this is typically controlled in the block or widget settings (e.g., the WordPress Query Loop block or a page builder widget) where you can set the link to the single post.
- Spacing Between Images: To add space between images without adding manual line breaks, you can use custom CSS like
.entry-content .wp-block-image { margin-bottom: 30px; }.
Important Considerations
It's important to distinguish between issues related to the free GeneratePress theme and those that require GeneratePress Premium. For example, creating a "Page Hero" with the Elements module is a feature of the Premium plugin. Similarly, advanced background image controls are part of the Premium offering. For issues with third-party plugins like Elementor, it's often best to also consult that plugin's support resources, as the theme and page builder can interact in complex ways.
By understanding how the theme handles featured images and using the correct method to control them, you can achieve the desired layout without conflict.
Related Support Threads Support
-
featured image showing huge in desktop but is alright in mobile viewhttps://wordpress.org/support/topic/featured-image-showing-huge-in-desktop-but-is-alright-in-mobile-view/
-
Changes on homepage not showing up when updating in editor -purged cache alreadyhttps://wordpress.org/support/topic/changes-on-homepage-not-showing-up-when-updating-in-editor-purged-cache-already-2/
-
Unable to set SiteIconhttps://wordpress.org/support/topic/unable-to-set-siteicon/
-
Problem with Featured Image on Pageshttps://wordpress.org/support/topic/problem-with-featured-image-on-pages/
-
Changes in elementor are not shown on the website (sometimes they are)https://wordpress.org/support/topic/changes-in-elementor-are-not-shown-on-the-website-sometimes-they-are/
-
Post imageshttps://wordpress.org/support/topic/post-images-19/
-
Menu Cart Icon Stylehttps://wordpress.org/support/topic/menu-cart-icon-style/
-
No Image when I share URL by text messagehttps://wordpress.org/support/topic/no-image-when-i-share-url-by-text-message/
-
Feature Image still shows in Elementor Full Width Pagehttps://wordpress.org/support/topic/feature-image-still-shows-in-elementor-full-width-page/
-
Can not change page hero blackground image in generate presshttps://wordpress.org/support/topic/can-not-change-page-hero-blackground-image-in-generate-press/
-
Custom product page with Elementor Pro no Woocommerce info displayinghttps://wordpress.org/support/topic/custom-product-page-with-elementor-pro-no-woocommerce-info-displaying/
-
Featured Image ALT Tag not showing uphttps://wordpress.org/support/topic/featured-image-alt-tag-not-showing-up/
-
Background image?https://wordpress.org/support/topic/background-image-215/
-
Header on the Single Pagehttps://wordpress.org/support/topic/header-on-the-single-page/
-
Assistance needed with CSS: Shadows/Bordershttps://wordpress.org/support/topic/assistance-needed-with-css-shadows-borders/
-
How to Put Header Image in GeneratePresshttps://wordpress.org/support/topic/how-to-put-header-image-in-generatepress/
-
Generate press. Page Herohttps://wordpress.org/support/topic/generate-press-page-hero/
-
Image size – featured, blog and categoryhttps://wordpress.org/support/topic/image-size-featured-blog-and-category/
-
GeneratePress Featured Image Not Clickablehttps://wordpress.org/support/topic/generatepress-featured-image-not-clickable/
-
Featured image appearing on top of pageshttps://wordpress.org/support/topic/featured-image-appearing-on-top-of-pages/
-
Featured image wrong sizehttps://wordpress.org/support/topic/featured-image-wrong-size/
-
How to Add Space Between Images in GeneratePress?https://wordpress.org/support/topic/how-to-add-space-between-images-in-generatepress/
-
html not working on Generatepresshttps://wordpress.org/support/topic/html-not-working-on-generatepress/
-
Bug report: Logo not showing on mobile; and solution (for my case)https://wordpress.org/support/topic/bug-report-logo-not-showing-on-mobile-and-solution-for-my-case/
-
GP shows header and footer after choose a page as post pagehttps://wordpress.org/support/topic/gp-shows-header-and-footer-after-choose-a-page-as-post-page/
-
Logged in users, page resets to Generate Press Default Widthhttps://wordpress.org/support/topic/logged-in-users-page-resets-to-generate-press-default-width/
-
Attachment pages in Child Themehttps://wordpress.org/support/topic/attachment-pages-in-child-theme/
-
background image on the homepage to be different for the mobile, desktop, and tahttps://wordpress.org/support/topic/background-image-on-the-homepage-to-be-different-for-the-mobile-desktop-and-ta/
-
Generatepress Theme Featured Image Size Problemhttps://wordpress.org/support/topic/generatepress-theme-featured-image-size-problem/
-
My hero image does not loadhttps://wordpress.org/support/topic/my-hero-image-does-not-load/
-
Site not displaying full widthhttps://wordpress.org/support/topic/site-not-displaying-full-width/
-
all images are thumbnailshttps://wordpress.org/support/topic/all-images-are-thumbnails/
-
Issue with emojis and shapes converting to SVG imageshttps://wordpress.org/support/topic/issue-with-emojis-and-shapes-converting-to-svg-images/