Ceci est en fait un sujet dupliqué. Je lui ai répondu ici : How to add and remove a flag for a post in a plugin.