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?
- $_POST form request with admin-post
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- Export data as CSV in back end with proper HTTP headers
- Completely remove WP_Admin_Bar for specific user roles
- 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
- 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
- Check if I am in the Admin Panel (wp-admin)?
- How to add custom content under plugin row in WordPress admin plugin list?
- How to put placeholder text in the main post input area?
- 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
- Plugin options page – form with two different submit buttons
- WP AJAX is not working, always returns 0
- Add notification bubble notice in navigation using transients
- add a class when login
- Add a panel to edit post
- 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
- 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
- Prevent third party plugin’s admin page access based on user type
- 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
- How can I replace content in the WP Admin area before an admin page is rendered?
- 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
- Avoid updating post when sending POST or GET request to post.php
- Enqueue script globally
- How do I add a favicon that only shows during viewing of my plugin’s admin panel?
- 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
- 400 Bad Request, in wordpress theme development, wp_ajax
- How can I add a simple custom field to my plugin?
- How to import the css in the plugin admin area?
- Run JavaScript validation script on form submit in plugin
- I am unable to save my data from a form
- Wp-admin Custom User Management
- Admin Subpages without Menu entry
- Data not insert and update through ajax and jQuery in admin page?
- Is it possible to load the css just on my plugin admin page?
- AJAX button with success callback. (Titan Framework)
- Disable Auto-Expanding Menu in WordPress Admin Menus
- How do I force a download in the admin area?
- A function that will remove HTML and tags from a string?
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- 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?
- Get cat parameter from admin-ajax
- WordPress: redirecting to the form page after form submission to admin-post.php
- How to create a custom post-new.php page for plugin , no wp menu
- WordPress admin panel not working
- 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
- Change Label of custom post type
- 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
- 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
- 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?
- wp_mail links are dead
- Forcing ALL plugin Admin menus into a separate menu
- Multi-part form and wp_redirect()
- WordPress multiple user roles accessing on their information on one site?
- Page reload occurs before request finishes
- Submitting a plugin form to database in admin page
- How do I display and edit other posts within the ‘Edit Post’ area of Wp-Admin Dashboard