How to add default image to post without thumbnail?

Use the iworks_upprev_image action:

<?php
add_action( 'iworks_upprev_image' , 'default_image' );
function default_image()
{
    return '<img src="image.png" alt="" />';
}

Where to put this code?

There are three ways:

  1. made a one-file-plugin and put file into wp-content/plugins, then turn it on
  2. made a one-file-plugin and put file into wp-content/mu-plugins
  3. put this code into functions.php in current theme

I recommend using option 1 or 2, but 3 is the easiest.

Published by

Marcin Pietrzak

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis nec ante nec lectus laoreet feugiat. Donec aliquet justo in tellus gravida, id elementum magna convallis. Curabitur faucibus mauris sed risus egestas lobortis. Nunc vestibulum elit ac ipsum ultricies, non ultrices lorem ultrices. Nam at dolor id elit lobortis ullamcorper. Fusce commodo turpis nisi, efficitur efficitur libero dictum eget. Morbi viverra dignissim lacus. Vestibulum mi justo, dictum ut iaculis eget, scelerisque et nibh.

One thought on “How to add default image to post without thumbnail?”

Leave a Reply

Your email address will not be published. Required fields are marked *