Conditionally display featured image on singular posts and pages


Important notice

If your theme does a customized call to load the featured image (like the Twenty Seventeen theme), this plugin might not work! Use get_the_post_thumbnail() or wp_get_attachment_image() to be sure it will work.
By default, the plugin also only hides the featured image, if it is loaded within the loop. See the FAQ on how to use the plugin if you theme loads the featured image outside the loop.


This plugin lets you choose for each post or page, if the featured image should be shown in the single view. This can get handy, if you use the featured image to show a thumbnail on the archives or front page but you don’t want the featured image to be shown on every posts view itself.

The plugin adds a simple checkbox to the featured image panel (or meta box if you are using the classic editor), that lets you choose, if the featured image will be shown in the singular view or not.

Snimke zaslona

  • Backend
  • Frontend


  1. Upload the plugin files to the /wp-content/plugins/conditional-featured-image directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the Plugins screen in WordPress


The plugin doesn’t work with my theme. What can I do?

Typically there are two possibilities why the plugin is not compatible with your theme:

1) The theme loads the featured image before the loop (e.g. in the header).
2) The theme makes a custom call to load the featured image.

In case 1 you can initialize the plugin early and disable the in_the_loop check. To do so, add the following snippet to your functions.php:

function cybocfi_set_startup_hook() {
    return 'get_header';

add_filter( 'cybocfi_startup_hook', 'cybocfi_set_startup_hook' );
add_filter( 'cybocfi_only_hide_in_the_loop', '__return_false' );

Be aware, that this might have some side effects: e.g. it might also hide the featured image from plugins that would normally see it, like SEO plugins or the ‘latest posts’ plugin.

In case 2 either

  • kindly ask the theme developer to use one of the dedicated WordPress functions (wp_get_attachment_image(), get_the_post_thumbnail(), the_post_thumbnail()) to load the featured image in the singular views.
  • or create a child theme that replaces the call, that loads the featured image, with one of the methods listed above.

Is this plugin GDPR compliant?

This plugin does not process or store any personal information. Hence, it is fully GDPR compliant without any further ado.

Can I hide featured images by default?

Yes. Just add the following line to your functions.php:

add_filter('cybocfi_hide_by_default', '__return_true');

All new posts and pages will now hide the featured image by default (checkbox is checked by default). Existing posts and pages won’t be changed.

You may also set different default values depending on the post type:

function cybocfi_set_default_hiding_state( $default, $post_type ) {
    if ( 'post' === $post_type ) {
        $default = true; // set the default state for posts
    } else if ( 'page' === $post_type ) {
        $default = false; // set the default state for pages

    return $default;
add_filter( 'cybocfi_hide_by_default', 'cybocfi_set_default_hiding_state', 10, 2 );

Can I limit this plugin to posts (and exclude other post types)?

Yes. By default, the plugin is available on any post type, that has a featured image. But there is a filter, that lets you control, for with post types the plugin should be available. The following example limits it to posts only:

function cybocfi_enable_by_post_type( $post_type ) {
    return 'post' === $post_type;
add_filter( 'cybocfi_post_type', 'cybocfi_enable_by_post_type' );

The filter provides you the current post type and you can decide if you want to use the plugin for this post type by returning true to enable and false to disable it. Add the following snippet to your functions.php to enable the plugin for posts and pages, but disable it for any other post type:

function cybocfi_enable_by_post_type( $post_type ) {
    $allowed_post_types = array( 'post', 'page' ); // add any post type you want to use the plugin with
    return in_array( $post_type, $allowed_post_types );
add_filter( 'cybocfi_post_type', 'cybocfi_enable_by_post_type' );

Is it possible to get the plugin in my language?

Absolutely. You’re invited to contribute a translation in your language. Please keep in mind, that the translation needs to be reviewed by the community, so it will take a little while until it gets accepted.

How can I change the text of the checkbox?

There is a filter hook for this. Add the following snippet to your functions.php:

function cybocfi_set_featured_image_label( $label ) {
    return 'Hide featured image in post'; // change this string
add_filter( 'cibocfi_checkbox_label', 'cybocfi_set_featured_image_label' );

I can’t save posts in WordPress 5.7.0

A bug in WordPress core #52787 may render this plugin unusable if a second plugin uses post meta values in a certain way. People who are affected by this problem see the following error message “Updating failed. Could not delete meta value from database.”. As the issue is related to WordPress core the workaround is to downgrade to WordPress 5.6.2 or to upgrade to WordPress 5.7.1. To our current knowledge, only very few users are affected by this defect. The Conditionally display featured image on singular posts and pages plugin itself works as expected for WordPress 5.7.0 and the issue may only appear if a second plugin triggers the bug in WordPress core.


02. prosinca 2021.
I was able to get this working on Genesis Press themes by adding the following code. function wp234_featured_post_image($v) { global $post; if ( is_singular( 'post' ) && get_post_meta( $post->ID, 'cybocfi_hide_featured_image', true ) ) { return '<!-- hide featured image --> '; } return $v; } add_filter( 'genesis_pre_get_image', 'wp234_featured_post_image', 8 );
07. listopada 2021.
I like to have a featured image in the list of posts that people can see for a more 'at a glance' on what the post is about, but I don't always want the image showing twice, both as featured image before the content, and later on in the post as well. This solves my problem. Thanks for this great plugin!
19. srpnja 2021. hides a featured image from a post ONLY while keeping it in lists. That's very important because if the image is used to create a thumbnail within project/portfolio lists/masonry views, the image won't be missing from there (which unfortunately is what happens with other plugins such as "Zi Hide Featured Image" by Zen Invader). That said though it defeats the purpose because the full space where the image and often page title are shown will remain there and since most themes are built to show a placeholder rather than keeping the area empty of collapse it (with a display:none for instance), then you'd be left with a missing featured image at the top of the post which will now show a placeholder with the title page over it. This happens with the theme Bauhaus by Highsea, but also with other themes when using a classic page mode which means a standard WP page where images and text can be added in the "usual" way. I'd suggest to improve by making the hide on single post to also have an option to collapse the featured image area on that very same post.
19. siječnja 2021.
I was getting frustrated trying out all sorts of codes and plug-ins. This is the only one that worked with my theme
Pročitajte sve 24 recenzije

Suradnici i Programeri

“Conditionally display featured image on singular posts and pages” is open source software. The following people have contributed to this plugin.


“Conditionally display featured image on singular posts and pages” je prijeveden na 3 dijalekta. Zahvala prevodiocima za njihov doprinos.

Prevedite “Conditionally display featured image on singular posts and pages” na svoj jezik.

Zainteresirani ste za razvoj?

Pregledajte kôd, pogledajte SVN spremišteili se pretplatite na dnevnik razvoja od RSS.

Dnevnik promjena


  • Added filter to bypass the in_the_loop() test so the plugin can be made compatible with themes that load the featured image outside the main loop.


  • Fixed bug that was hiding the featured image in the latest posts widget. Props to @molcsa for pointing this out.
  • Updated dependencies


  • Extended FAQ
  • Updated dependencies
  • Tested up to WordPress 5.8.2


  • Added hook for early initialization
  • Extended FAQ
  • Small refactorings
  • Updated dependencies


  • Tested up to WordPress 5.7
  • Updated dependencies


  • Added support for the Custom Post Type UI plugin
  • Updated dependencies


  • Added support for the twentynineteen theme


  • Fix: Do not remove the featured image in queries executed after the main query
  • Updated dependencies


  • Respect the cybocfi_hide_by_default filter for programmatically added posts
  • Small refactorings
  • Tested up to WordPress 5.6.0
  • Updated dependencies


  • Added filter to hide featured images by default
  • Tested up to WordPress 5.5.1
  • Extended FAQ
  • Updated dependencies


  • Tested up to WordPress 5.5 (RC1)
  • Extended FAQ
  • Updated dependencies


  • Allow to enable/disable the plugin by post type


  • Allow filtering the featured image checkbox label
  • Update readme
  • Update dependencies


  • Exclude none essential data from SVN


  • Update dependencies


  • Add support for Yoast SEO (don’t filter image for the social header data)


  • Add support for the block editor (Gutenberg)
  • Tested up to WordPress 5.2.2


  • Makes sure, we do only modify the main post
  • Tested up to WordPress 5.0.0


  • Make it more robust so it will also work with Elementor
  • Tested up to WordPress 4.9.6


  • Tested up to WordPress 4.7.3
  • Tested up to WordPress 4.8.0
  • Tested up to WordPress 4.9.0


  • Tested up to WordPress 4.7.2


  • Get ready for language packs (set text domain equal to the name of the plugins folder, remove load_plugin_textdomain)


  • Tested up to WordPress 4.7.0
  • Removed language folder. Languages are now loaded from


  • Improve plugin title
  • Improve checkbox string
  • Improve documentation
  • Updated stable tag


  • Updated stable tag


  • Extended functionality to pages


  • Initial public release