How a HTML form can trigger a PHP function?

It sounds like you want an AJAX request of some sort. In your functions.php file, enqueue some JavaScript to handle the form. wp_register_script( ‘my-scripts’, get_stylesheet_directory_uri() . ‘/[path to your scripts]/myscripts.js’, array( ‘jquery’ ), ‘1.0’, true ); See this link for reference. Right under that, add a JavaScript variable for your AJAX URL. wp_localize_script( ‘my-scripts’, ‘data’, … Read more