Cannot exclude MEC post type from showing default image
-
Hello,
Thanks for the plugin, it works great!
I am using Default Featured Image (DFI) as well as Modern Events Calendar (MEC) on my site. Once activated, DFI works as expected. The fallback featured image is show on all posts without a specified image, even events created within MEC.
However, I wish to exclude MEC posts from DFI’s influence as it has it’s own fallback image mechanics for event categories. Using dfi_thumbnail_id filter like this…
function dfi_no_page_post( $dfi_id, $post_id ) { $post = get_post( $post_id ); if ( in_array($post->post_type, array( 'mec-events',)) ) { return 0; // Don't use DFI for this post or pages } return $dfi_id; // the original featured image id } add_filter( 'dfi_thumbnail_id', 'dfi_no_page_post', 10, 2 );
…doesn’t work. The default image set in DFI settings is still shown. If I use the same filter for one of my own custom post types (say ‘formations’), it works fine, not using the fallback image on ‘formations’ type posts.
Any ideas?
Thank you!
- The topic ‘Cannot exclude MEC post type from showing default image’ is closed to new replies.