Open harry-maulana opened 8 years ago
i has add wp_ajax_nopriv, but still don't work for guest (unauthorized user), please help me master..
I don't know if you solved it already but anyway i want to put the solution here.
In class-plugin-name.php there is a public function define_public_hooks();
Add the action needed to handle the form submission there:
$this->loader->add_action( 'process_handle_form_submission', $plugin_public, 'process_handle_form_submission' );
In the same file, add the public method process_handle_form_submission
. Now when the form is submitted, you can access the $_POST
in process_handle_form_submission
and handle the request.
For security reasons, always make use of the wp_nonce_field.
If you still have question, let me know.
Maybe somebody have a repo with this example $this->loader->add_action( 'process_handle_form_submission', $plugin_public, 'process_handle_form_submission' );
where to put wp_ajax_nopriv? in main class (class-plugin-name.php) or in admin class(class-plugin-name-admin.php) or in public class(class-plugin-name-public.php)?
thanks..