wordpress plugin php file processing form

admin2025-06-02  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.

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.

Share Improve this question asked Mar 13, 2019 at 13:11 alpha.romeoalpha.romeo 491 gold badge1 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748810608a313914.html

最新回复(0)