I am learning WordPress Plugin Development. I am Submitting a Form in Admin Panel. My form code is like below
<form method="post" action="<?php echo admin_url( 'admin-post.php?action=my_action' ); ?>" name="newAddress" id="createuser" class="validate" novalidate="novalidate">
I am catching Form submission in index.php
file using below code.
add_action('admin_post_my_action', 'my_callback_fn');
function my_callback_fn() {
echo 'hello';
}
I need Form validation message like below
I need to keep values of the Form fields with them after displaying Form validation message like below.
How can I do that ?
Some developers suggest me to use admin_init hook. But how to use that ?