You can store field values and error messages in session or transient and use them when (re)displaying your form.
In your callback action, if data is not valid, save error message and submitted field values. In admin_notices hook check for saved error message. If there is one, show it as error notice. Don’t forget to remove saved session/transient value.
In form builder code check session/transient for saved field values, if there are such, use them in value="..." or as needed.
This might help.
Related Posts:
- Submit form to a different PHP file in the same plugin folder
- Post data in wp-admin to external database
- $_POST form request with admin-post
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- Plugin API for easy admin list table generation, handling & exporting of MySQL tables?
- What is the real intention for admin-post.php?
- Completely remove WP_Admin_Bar for specific user roles
- API to trigger prompt on leaving page
- Show message on wordpress admin dashboard
- Hook the Keydown Event in the TinyMCE Post Editor
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- how to use thickbox in admin?
- Cancel post save
- Add a jQuery function to admin pages
- Using AJAX in a plugin to submit form – REALLY confused
- Is it save to require plugin.php early to be able to use get_plugin_data() earlier?
- WP Cron doesn’t save or in post body
- Create a clickable name in WP_List_Table for Plugin Admin
- Post from front-end with post types, categories and taxonomies
- Front-End Form Submission in Shortcode
- Problems with removing admin bar
- Check if I am in the Admin Panel (wp-admin)?
- How to add custom content under plugin row in WordPress admin plugin list?
- Front-End Interfaces Without Shortcodes
- How to load the plugin only when logged in?
- How to redirect to action on custom page within admin section
- WP AJAX is not working, always returns 0
- Add notification bubble notice in navigation using transients
- Can I individually style items in the backend widget list?
- Where should I put “run once” plugin pages?
- Modify users.php page to create page/post on button clicked
- Issue plugin commands in admin settings page
- Programmatically modify an admin page UI of a WordPress site from my WordPress plugin
- WooCommerce registration password field not displaying
- wordpress plugin php file processing form
- Problems with: manage_${post_type}_posts_columns
- How to add custom fields to the all users page
- Global State During an Admin Post
- Render content after post title in wp-admin
- Error on inserting a form value to database
- Multiple options pages validation for a plugin
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Form doesnt save to database
- How to add WordPress Admin “Insert Link” UI (searches through existing posts for URL) and functionality into a custom plugin?
- Is it possible to restrict all admin pages except theme customisation and storefront using plugin?
- Admin – Handle data before creating or updating a post, page or custom post
- wp_filesystem put_contents issue with owner/group
- Create custom HTML/JS app inside page
- Plugin Development for registered users
- Is there documentation reference for forms in menu and setting pages?
- Input in plugin widget does not allow spaces
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- Avoid updating post when sending POST or GET request to post.php
- Issue with contextual help overwriting existing content
- Alternatives to DISALLOW_FILE_EDIT wp-config Constant? It Breaks Some Plugins
- admin_post equivalent for guest user?
- How do I link to a php file in my plugin directory?
- WordPress Admin Login Custom Logo
- How to create custom settings page for custom plugin
- How can I add a simple custom field to my plugin?
- Run JavaScript validation script on form submit in plugin
- I am unable to save my data from a form
- How to add search form in main page body?
- Filter for admin (back end) ‘reply to’ comment
- How to make and save custom form in custom plugin page?
- Redirect in WordPress plugin
- Form using admin-post.php gives 404 after submission
- How to add custom view links to wp-admin/post.php?
- Using admin-post.php for admin form but it directs me to admin-post.php white screen
- jQuery UI tab does not work in the plugin page
- Best practice for plugin: always detect admin-ajax call?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Form submission to another page returning 404 error [duplicate]
- How do I duplicate a single post, with all its properties, and save it as a different post?
- Remove Meta-boxes (Yoast SEO plugin) [duplicate]
- How to add text editor in plugin menu?
- check_admin_referer()
- Information and Page from WordPress Plugin
- Add New Button in Admin Panel
- I cant add is_admin control to plugin
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- Use admin-post to submit form data to external database
- Stop unauthorised file access
- How to Maintain url on form submit
- How to retrieve custom profile fields associated with different users
- Get (eventual) permalink from post within Edit Post in Admin panel
- Acessing WP functions in form submission handler
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- Issue with iframe in TinyMCE
- Best way to handle a form post in plugin
- admin page passing $_POST variables to itself
- Page reload occurs before request finishes
- modify buddpress adminbar only in admin pages
- How to change the headline title for an admin page in a plugin?
- How do I display and edit other posts within the ‘Edit Post’ area of Wp-Admin Dashboard
- How to use native wordpress translation domain inside a custom plugin?
- Select a Text for CSS
- WordPress – Filter users list count
- Customize Message