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

How can I show a specific page to admins only?

if not admin redirects to front page try this function in the top of the file if(!current_user_can(‘administrator’)){ echo ‘<a href=”‘.home_url().'” id=”notAdmin”></a>’; echo ‘<script>document.getElementById(“notAdmin”).click();</script>’; }