You can give a player an effect (ie: potion effect) or remove an effect from a player whenever you want using the /effect command in Minecraft. Let's explore how to use this cheat (game command).TIP: If you need help generating your /effect command, try our Status Effect Generator....
But when I looked up how to do it, (using a command generator like MCStacker), the command was valid but the food didn’t give me the effect. I asked about this on Reddit, but their suggestions didn’t change the outcome. So I can only conclude this is a bug...