In my opinion, it’s fine to have a note on the program that reminds people that only Catholics who are appropriately disposed should take communions. I’ve been to Catholic weddings where non-Catholic attendees got into the communion line. They weren’t trying to be disrespectful, they just genuinely weren’t aware.
On the other hand, making an announcement that says “If you haven’t been in awhile, please go” strikes me as incredibly bossy and patronizing. How often someone goes to confession and when is between them and God, not you.