1

i try to analyse a plugin operations , and , at some point we fill a form to be process , but i don't know by who the form is processed as i have this kind of html form , so i wonder how i can know the final php file who handle realy my form.

  <form method="post" action="<?php echo esc_url( admin_url( 'admin- 
      post.php' ) ); ?>">
        <input type="hidden" name="action" value="check_imported">
        <input type="hidden" name="importer" value="<?php echo esc_attr( 
        $uid ); ?>">
        <?php wp_nonce_field( 'check_imported', 'check_imported', false ); 
          ?>
        <table class="import">

thank you for your help.

1 Answer 1

1

The form action is the file that handles the form, which you can see is the admin-post.php file in your WordPress installation.

However what you are really looking for is the hook that handles the form.

Basically, the form is getting submitted to admin-post.php, which then uses the "action" value in your form to determine what hook to trigger; in other words, what code to run. This is a common WordPress paradigm.

The hook name is generated in this format:

admin_post_{{action}} for logged in users, and admin_post_nopriv_{{action}} for non-logged in users

In your case the action is set to "check_imported". So if you are trying to find code that is already handling these, do a search in your theme/plugins for "admin_post_check_imported" and/or "admin_post_nopriv_check_imported".

They would be written as an add_action call, connecting the hook name to some other function, like:

add_action( 'admin_post_check_imported', 'some_function_name');

So you would then look for the function named, "some_function_name", for the actual code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.