• Hello everybody,

    I am trying to understand which is the best hook ( or method ) to use when we have to handle data sent from user ( form ).

    If we are in the admin panel I use the admin_action_(action) or admin_post_(action).
    If we are in the front end I was wondering if there’s something like the two hook of the admin panel. If not there’s what I think:

    1) Use the init hook and check there if there’s a $_POST like “check-my-form”, then handle the data, and then redirect to referrer url ( out front page ). In this way we call wordpress core twice, one for handle and the other as a redirect.

    2) Handle the data in the same template of the form, just before output the data ( template_redirect hook).

    What do you think?
    thanks!

  • The topic ‘the best hook to elaborate data from form’ is closed to new replies.