Title: Default Featured Image
Author: Jan-Willem
Published: <strong>25. decembra 2012</strong>
Last modified: 29. nowembra 2025

---

Tykače pytać

![](https://ps.w.org/default-featured-image/assets/banner-772x250.jpg?rev=1058491)

![](https://ps.w.org/default-featured-image/assets/icon-256x256.jpg?rev=1058491)

# Default Featured Image

 Wot [Jan-Willem](https://profiles.wordpress.org/janwoostendorp/)

[Sćahnyć](https://downloads.wordpress.org/plugin/default-featured-image.1.8.2.zip)

[Live Preview](https://hsb.wordpress.org/plugins/default-featured-image/?preview=1)

 * [Podrobnosće](https://hsb.wordpress.org/plugins/default-featured-image/#description)
 * [Pohódnoćenja](https://hsb.wordpress.org/plugins/default-featured-image/#reviews)
 *  [Instalacija](https://hsb.wordpress.org/plugins/default-featured-image/#installation)
 * [Wuwiće](https://hsb.wordpress.org/plugins/default-featured-image/#developers)

 [Podpěra](https://wordpress.org/support/plugin/default-featured-image/)

## Wopisanje

Add a default featured image to the media settings page. This featured image will
show up if no featured image is set. Simple as that.

Take a look at [FAQ](https://wordpress.org/extend/plugins/default-featured-image/faq/)
for the basic questions.
 Feel free to contact me [on the forum](https://wordpress.org/support/plugin/default-featured-image/)
or on the [github repository](https://github.com/janw-me/default-featured-image).

## Fota wobrazowki

 * [[
 * The setting on the media page
 * [[
 * The media manager will start with the current selected image

## Instalacija

 1. Unzip the folder to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‚Plugins‘ menu in WordPress
 3. Go to the settings->media page and select an image.

## HSP

### My chosen featured image doesn’t show, why isn’t it working?

This plugin works out of the box for most cases, but not always. If it doesn’t work
you can try the following things.

 * Switch themes. Most of the time the theme does something weird.
 * Are you using the Core WordPress functions to get the image? (see the FAQ below
   this one).
 * Do normal feature images work?
 * Might it be hidden via css? DFI images have an extra `default-featured-img` class
   added to them.

Still having problems? I want to know if it fails, so [contact me](https://wordpress.org/support/plugin/default-featured-image)

### Which functions can I use to display the featured image?

There are no new functions, all core WordPress functions can be used.

 * [the_post_thumbnail](https://developer.wordpress.org/reference/functions/the_post_thumbnail/)/
   [get_the_post_thumbnail](https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/)
   Display the image.
 * [the_post_thumbnail_url](https://developer.wordpress.org/reference/functions/the_post_thumbnail_url/)/
   [get_the_post_thumbnail_url](https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/)
   Get the url.
 * [has_post_thumbnail](https://developer.wordpress.org/reference/functions/has_post_thumbnail/)
   If a DFI is set it will always return true.
 * [get_post_thumbnail_id](https://developer.wordpress.org/reference/functions/get_post_thumbnail_id/)
   will return the ID set on the post or the DFI.

### Can I set a different image for a custom post type?

Yes, the following code will set a different image.

    ```
    add_filter( 'dfi_thumbnail_id', 'dfi_posttype_book', 10, 2 );
    function dfi_posttype_book( $dfi_id, $post_id ) {
        $post = get_post( $post_id );
        if ( 'book' === $post->post_type ) {
            return 31; // the image id for the book post type.
        }

        return $dfi_id; // the original featured image id.
    }
    ```

### Can I set different images per category?

Yes, the following snippet will set different images based on the category.

    ```
    add_filter( 'dfi_thumbnail_id', 'dfi_category', 10, 2 );
    function dfi_category( $dfi_id, $post_id ) {
        // Set a different image for posts that have the 'cats' category set.
        // This will trigger first, if multiple categories have been set.
        if ( has_category( 'cats', $post_id ) ) {
            return 7; // cats img id.
        }
        // Set a different image for posts that have the 'cats' category set.
        if ( has_category( 'dogs', $post_id ) ) {
            return 8; // dogs img id.
        }

        return $dfi_id; // the original featured image id.
    }
    ```

### Can I change the HTML of the default featured image?

When a Default Featured Image is used it will already add an extra class `default-
featured-img`.
 This can be used for styling.

If you need more you can change the whole HTML with the filter `dfi_thumbnail_html`.

    ```
    add_filter( 'dfi_thumbnail_html', 'dfi_add_class', 10, 5 );
    function dfi_add_class( $html, $post_id, $default_thumbnail_id, $size, $attr ) {
        // Add a class to the existing class list.
        $attr['class'] .= ' my-class';

        return wp_get_attachment_image( $default_thumbnail_id, $size, false, $attr );
    }
    ```

### Can I exclude one page from having a Default Featured Image?

The following code will exclude the post/page with ID 23.

    ```
    add_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10, 2 );
    function dfi_skip_page( $dfi_id, $post_id ) {
        if ( $post_id == 23 ) {
            return 0; // invalid id.
        }

        return $dfi_id; // the original featured image id.
    }
    ```

## Pohódnoćenja

![](https://secure.gravatar.com/avatar/c3bd0663e38a2e6496cc97a6a86b446d4701ed8e64cada9dac446564745b4127?
s=60&d=retro&r=g)

### 󠀁[Awesome plugin, great support.](https://wordpress.org/support/topic/awesome-plugin-great-support-94/)󠁿

 [Matt Rock](https://profiles.wordpress.org/mattrock1/) 4. apryla 2025

Loving this plugin. And when I need to fine tune it, a quick browse through the 
FAQs and Support Threads and I found everything I needed. Great plugin.

![](https://secure.gravatar.com/avatar/fd20413fafddcb021679533e29a04def74ac1b710eef07e1ce6dc8b86de958d3?
s=60&d=retro&r=g)

### 󠀁[Does what is says on the tin – thanks!](https://wordpress.org/support/topic/does-what-is-says-on-the-tin-thanks/)󠁿

 [pst247](https://profiles.wordpress.org/pst247/) 1. apryla 2025

A very handy little plugin that fills an obvious hole in Wordpress’s feature list.

![](https://secure.gravatar.com/avatar/09135b8101e20c508c66ecf2c1dd0850864324190d18b6596dcb4e9301dc4318?
s=60&d=retro&r=g)

### 󠀁[Exactly what I need](https://wordpress.org/support/topic/exactly-what-i-need-175/)󠁿

 [phakkers](https://profiles.wordpress.org/phakkers/) 12. měrca 2025

Hi Jan-Willem,I was looking for a default featured image, ChatGPT suggested your
plugin. Exactly what I need. Thanks!Pascal

![](https://secure.gravatar.com/avatar/ad90cef47f18eec2a5e174ddac9db895a74d428b000a748c1d4c3dde93a13bff?
s=60&d=retro&r=g)

### 󠀁[This is how a WordPress plugin should be!](https://wordpress.org/support/topic/this-is-how-a-wordpress-plugin-should-be/)󠁿

 [thaikolja](https://profiles.wordpress.org/thaikolja/) 12. oktobra 2024 1 reply

Thank you, @janwoostendorp, for this great minimalist and out-of-the-box working
plugin. I was looking for a plugin that’d set a default image to posts that don’t
have any, and this plugin is doing exactly that—nothing more, nothing less. It’s
not creating yet another admin menu bar item with dozens of subpages. It doesn’t
annoy you with constant dashboard notices. It doesn’t beg for donations or includes
any watermarks. It just works the way you expect it to work. It’s a little sad that
the bar is this low, but compared to so many other plugins, I think this needs to
be pointed out—and reach more people who want a simple solution for a simple problem.
The only feature I’d have liked to see is the support for images that are unavailable
and can’t be displayed to also use the default featured image. A quick glance inside
the code showed quite a bit of jQuery, which wouldn’t be my first choice, but it
made me think that adding a simple checkbox to have it checking for this (non-render
blocking, of course) could be a useful idea. Thanks for your work!

![](https://secure.gravatar.com/avatar/75134204f23d1efab7132b632225fcb8b5170bdc4da6c7303a7c6f0286fe89da?
s=60&d=retro&r=g)

### 󠀁[Ottimo! Aggiornamento!](https://wordpress.org/support/topic/ottimo-aggiornamento-2/)󠁿

 [baritono](https://profiles.wordpress.org/baritono/) 1. apryla 2024 1 reply

Funziona benissimo! speriamo che non sarà abbandonato

![](https://secure.gravatar.com/avatar/79e1a16ba5439d1b4d87b7dcbfd056e9d46a66bee0ca8b129a08121e040c7a5c?
s=60&d=retro&r=g)

### 󠀁[Wonderful Plugin that Just Works](https://wordpress.org/support/topic/wonderful-plugin-that-just-works/)󠁿

 [Dave Loebig](https://profiles.wordpress.org/pacesettermedia/) 14. měrca 2024

Default featured image does what it’s supposed to do and it meets two criteria I
always look for: light weight it just works The support forum has good answers to
questions, and that’s a big plus.Thanks for the great plugin.

 [ Čitajće 67 pohódnoćenjow ](https://wordpress.org/support/plugin/default-featured-image/reviews/)

## Sobuskutkowarjo a wuwiwarjo

„Default Featured Image“ je softwara wotewrjeneho žórła. Slědowacy ludźo su k tutomu
tykačej přinošowali.

Sobuskutkowarjo

 *   [ Jan-Willem ](https://profiles.wordpress.org/janwoostendorp/)

„Default Featured Image“ je so do 13 rěčow přełožił. Dźakujemy so [přełožowarjam](https://translate.wordpress.org/projects/wp-plugins/default-featured-image/contributors)
za jich přinoški.

[Přełožće „Default Featured Image“ do swojeje rěče.](https://translate.wordpress.org/projects/wp-plugins/default-featured-image)

### Na wuwiću zajimowany?

[Přehladajće kod](https://plugins.trac.wordpress.org/browser/default-featured-image/),
hladajće do [SVN-repozitorija](https://plugins.svn.wordpress.org/default-featured-image/)
abo abonujće [wuwiwanski protokol](https://plugins.trac.wordpress.org/log/default-featured-image/)
přez [RSS](https://plugins.trac.wordpress.org/log/default-featured-image/?limit=100&mode=stop_on_copy&format=rss).

## Protokol změnow

#### 1.8.2

 * Fixed typo in uninstall script.

#### 1.8.1

 * Small refactor, no code or feature changes.
 * Removed wp.org assets from plugin zip.

#### 1.8.0

 * Expose the DFI option via the rest API.

#### 1.7.3

 * PHP 7.4 and WP 6.2 are now required. This is to use the new [WP_HTML_Tag_Processor](https://make.wordpress.org/core/2023/03/07/introducing-the-html-api-in-wordpress-6-2/)
   functions.
 * Fixed a bug where classes were overridden.

#### 1.7.2.1

 * Development is now done in git.

#### 1.7.2

 * Added extra context to a translation as suggested by [Alex Lion](https://wordpress.org/support/topic/i18n-issue-14/)

#### 1.7.1

 * Fixed weird SVN deployment bug.

#### 1.7.0

 * moved main class to it’s own file.
 * Added second class that can hold exceptions with other plugins
 * The first exception is for WP User Frontend
 * The second exception is for WP All Import.

#### 1.6.4

 * `get_post_meta($post_id)` without specifying the meta_key didn’t find the DFI.
   It will now even use an even deeper level and set it in the core cache.

#### 1.6.3

 * Fixed plugin header which blocked installing it.

#### 1.6.2

 * Plugin now follows WP coding standard
 * Fixed a small bug where DFI overrides attachments featured images. mp3 has a 
   music note by default, DFI should not override that.

#### 1.6.1

 * Small readme.txt update.

#### 1.6

 * On of the last fixes didn’t account for all situations.

#### 1.5

 * Fixed two small (and rare) warnings
 * Added translation domain

#### 1.4

 * Added plugin images both the plugin header as the thumbnail. Based on the boat
   WP.org uses in it’s theme previews
 * Fixed a bug where the ajax calls didn’t return the DFI [forum thread](https://wordpress.org/support/topic/dfi-woocommerce-facetwp?replies=10)

#### 1.3

 * Filter `dfi_thumbnail_id` now also returns the post ID of the post (or any postype)
   that is being called. See the FAQ for new examples

#### 1.2

 * Filter `dfi_thumbnail_id` is now called in an earlier stage.

#### 1.1

 * Fixed inheriting classes of the image

#### 1.0

 * Plugin will now remove it’s setting on plugin removal
 * added a default class to the `<img>` tag, if it shows a default featured image
 * The default featured image will now also return with `get_post_thumbnail_id`,
   making the chance that it fail far far smaller.
 * The image given in the media page is now validated

#### 0.9

 * Launch

## Meta

 *  Version **1.8.2**
 *  Last updated **5 měsacow**
 *  Active installations **70.000+**
 *  WordPress version ** 6.2 abo nowši **
 *  Tested up to **6.9.4**
 *  PHP version ** 7.4 abo nowši **
 *  Languages
 * [Chinese (China)](https://cn.wordpress.org/plugins/default-featured-image/), 
   [Chinese (Taiwan)](https://tw.wordpress.org/plugins/default-featured-image/),
   [Danish](https://da.wordpress.org/plugins/default-featured-image/), [Dutch](https://nl.wordpress.org/plugins/default-featured-image/),
   [Dutch (Belgium)](https://nl-be.wordpress.org/plugins/default-featured-image/),
   [English (US)](https://wordpress.org/plugins/default-featured-image/), [French (France)](https://fr.wordpress.org/plugins/default-featured-image/),
   [German](https://de.wordpress.org/plugins/default-featured-image/), [Hebrew](https://he.wordpress.org/plugins/default-featured-image/),
   [Norwegian (Bokmål)](https://nb.wordpress.org/plugins/default-featured-image/),
   [Spanish (Chile)](https://cl.wordpress.org/plugins/default-featured-image/), 
   [Spanish (Spain)](https://es.wordpress.org/plugins/default-featured-image/), 
   [Swedish](https://sv.wordpress.org/plugins/default-featured-image/) a [Turkish](https://tr.wordpress.org/plugins/default-featured-image/).
 *  [Přełožće do swojeje rěče](https://translate.wordpress.org/projects/wp-plugins/default-featured-image)
 * Tags
 * [image](https://hsb.wordpress.org/plugins/tags/image/)[media](https://hsb.wordpress.org/plugins/tags/media/)
 *  [Rozšěrjeny napohlad](https://hsb.wordpress.org/plugins/default-featured-image/advanced/)

## Pohódnoćenja

 4.9 out of 5 stars.

 *  [  63 5-star reviews     ](https://wordpress.org/support/plugin/default-featured-image/reviews/?filter=5)
 *  [  2 4-star reviews     ](https://wordpress.org/support/plugin/default-featured-image/reviews/?filter=4)
 *  [  1 3-star review     ](https://wordpress.org/support/plugin/default-featured-image/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/default-featured-image/reviews/?filter=2)
 *  [  1 1-star review     ](https://wordpress.org/support/plugin/default-featured-image/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/default-featured-image/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/default-featured-image/reviews/)

## Sobuskutkowarjo

 *   [ Jan-Willem ](https://profiles.wordpress.org/janwoostendorp/)

## Podpěra

Chceće něšto prajić? Trjebaće pomoc?

 [Forum pomocy pokazać](https://wordpress.org/support/plugin/default-featured-image/)