On a Wordpress website, I am using admin-post.php in a form (code below) on my website to trigger an action upon submitting the form, where I can process the $_POST items and set some cookies. This works fine if I set my account role to admin, but does not work if I simply change the role to subscriber (I will need my subscribers to be able to submit this form). As subscriber role, instead of running admin-post.php, it just redirects me to the website homepage, even though I am still logged in. So it acts like admin-post.php is not executable as subscriber role, but I am not sure how to change this... maybe I need a some kind of .htaccess code in the wp-admin dir? I am stumped... any ideas?
< form method='post' action='/wp-admin/admin-post.php'>
< input type='hidden' name='action' value='run_my_wp_action' >
//Other form items removed
<input type='submit' name='submit' value='Next' >
</form >
PHP in my WP plugin
add_action( 'admin_post_nopriv_run_my_wp_action', 'my_wp_action' );
add_action( 'admin_post_input_run_my_wp_action', 'my_wp_action' );
function my_wp_action() { //code }