• scarax

    (@scarax)


    Hi
    I’m not sure which actions i have to add to my plugin for the following problem as there are 10+ actions for comments/trackbacks on the Action Reference Page:

    I want to call my “function A” every time a new comment or trackbach is actually added to a post (which means every possible situation where a comment that was not displayed before is now displayed, for example a completely new comment which was activated directly, a comment which was activated in the backend or whatever)

    Additionally, i want to call my “function B” when a comment was removed (displayed before and now hidden/deleted)

    which action hook(s) do I have to use for this?

    thanks,
    ScaraX

Viewing 1 replies (of 1 total)
  • E

    (@visudo)

    I would use ‘comment_post’ for new posts. It’s described as:

    Runs just after a comment is saved in the database. Action function arguments: comment ID, approval status (“spam”, or 0/1 for disapproved/approved).

    And for deleting, try ‘delete_comment’

    These hooks will take into account the different comment types.

Viewing 1 replies (of 1 total)
  • The topic ‘Call my plugin’s function each time a comment is published or removed’ is closed to new replies.