Default Featured Image plugin

Knowledgebase Docs » UberMenu 2 » Plugin Integration
USEFUL? 1

If you are using the Default Featured Image plugin, it will automatically add images to your menu items. The plugin should probably offer a way to exclude certain post types, but you can do that programmatically with this code:

function dfi_no_image ( $dfi_id, $post_id ) {
  $post = get_post($post_id);
  if ( 'nav_menu_item' === $post->post_type ) {
    return 0; // the image id
  }
  return $dfi_id; // the original featured image id
}
add_filter( 'dfi_thumbnail_id', 'dfi_no_image', 10, 2 );

A good place to add this would be your child theme’s functions.php