Candy is sweet treat food item (using the term 'food' loosely, although in WoW, unlike real life, candy is good for you.) Candy is odd because it is not one of the six main types of food in WoW, but there are quite a few examples of candy and it is available from vendors. Candy is most often encountered at holiday events.
Presumably, since candy is not one of the food types that are referenced as being able to be eaten by hunter pets, hunters cannot feed candy to their pets.
Like other kinds of food, not all candy is food (provides health recovery over time). Some are consumables with an instant effect, some are cosmetic, and some are quest items.
In WoW, candy is defined by real world analogy and flavor text, who vends it, and the holiday contexts where it is used. It seems that WoW uses a broader definition of sweets than just candy, so ice cream cones are candy in WoW.
(These used to also be included in the [Smashed Pumpkin Loot] rewards, but as of 2009, these items no longer available from that source.)
In 2009, a two day event, Day of the Dead was added. This has one candy item, [Candy Skull], which can be purchased from Chapman, the Day of the Dead vendor, found in graveyards near the eight faction cities, Shattrath, and Dalaran. The Skull Candies only last during the event, then disappear.
During Hallow's End, if you defeat the Headless Horseman, small pumpkin 'meteors' fall from the sky, landing on the party members. Each of these contains a small random number of:
During Hallow's End, each Inn has a candy bucket on the floor that can be looted once per character for a [Handful of Candy]. Looting the candy bucket at each inn is a separate Candy Bucket quest.
[Bag of Heart Candies]: Binds on pickup. Has 10 charges and a cooldown of 10 minutes. When used, creates a [Heart Candy] with the player character's name stamped on it. Heart Candies are based on the real world Valentine's Day chalky confection. Each one bears an expression of affection such as "I'm all yours!" or "I'll follow you around Azeroth." Their only purpose is to give to other players.
Quest item candy
Quest items are items that are only quest objects. Quest items that look like food are not food, but food items can be quest objects.
Some candy is a quest item, and is not ingestible candy.