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
- How can I add an image upload field directly to a custom write panel?
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How do i best handle custom plugin page actions?
- Plugin Form Submission Best Practice
- $_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?
- Handling results from data hooked into admin_post
- Export data as CSV in back end with proper HTTP headers
- 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
- What is the recommended way to create plugin administration forms?
- 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?
- How do you create a custom edit.php / edit pages page
- 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
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- Post from front-end with post types, categories and taxonomies
- URLs of plugin resources?
- How to add custom view links to wp-admin/post.php?
- Is it possible to load the css just on my plugin admin page?
- Using admin-post.php for admin form but it directs me to admin-post.php white screen
- AJAX button with success callback. (Titan Framework)
- jQuery UI tab does not work in the plugin page
- Disable Auto-Expanding Menu in WordPress Admin Menus
- Best practice for plugin: always detect admin-ajax call?
- How do I force a download in the admin area?
- A function that will remove HTML and tags from a string?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- Form submission to another page returning 404 error [duplicate]
- Remove Permalink Meta Box not working?
- Lead form that submits to 2 external APIs
- 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?
- Get cat parameter from admin-ajax
- WordPress: redirecting to the form page after form submission to admin-post.php
- check_admin_referer()
- How to make an admin plugin menu page go full screen?
- How to create a custom post-new.php page for plugin , no wp menu
- Information and Page from WordPress Plugin
- WordPress admin panel not working
- Add New Button in Admin Panel
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- 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
- Change Label of custom post type
- Use admin-post to submit form data to external database
- Stop unauthorised file access
- How to Maintain url on form submit
- How to enable or disable check boxes in custom post type
- Redirect with message after admin_post.php
- How to retrieve custom profile fields associated with different users
- form does not generate $_POST request
- How to display properly exception or echo string after posting in plugin?
- Same header/footer in Admin, across all network sites in multisite
- Get (eventual) permalink from post within Edit Post in Admin panel
- Acessing WP functions in form submission handler
- Form and database, plugin development
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- Can I use a hook other than ‘init’ to handle form submissions?
- How to add conent (text) to Add New pages form of admin in WordPress
- Issue with iframe in TinyMCE
- wp_mail links are dead
- Forcing ALL plugin Admin menus into a separate menu
- Best way to handle a form post in plugin
- Tracing dashboard publish settings from input form in WordPress
- admin page passing $_POST variables to itself
- Multi-part form and wp_redirect()
- WordPress multiple user roles accessing on their information on one site?
- Page reload occurs before request finishes
- modify buddpress adminbar only in admin pages
- Submitting a plugin form to database in admin page
- Loading jQuery library from WordPress admin
- 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 prepend a header section to all pages related to my WordPress Plugin
- Hook a search form anywhere on the site, using a custom plugin
- Plugin forms overwrite each other’s options
- Form submission issue in wordpress admin (custom plugin) using $_GET for searching & filtering
- Update Cache on Save Instead of Clearing It?
- Create child of child custom page in wp-admin
- Load specific CSS file
- How to use native wordpress translation domain inside a custom plugin?
- Create a zip code form
- Select a Text for CSS
- WordPress – Filter users list count
- Customize Message