Creating Custom Admin Forms — a practical guide to WordPress admin forms with clear examples you can reuse in real projects.
WordPress Plugin Development Series (22/95). Prefer one article? Read the complete WordPress plugin development tutorial.
Short description
For non-Settings-API forms, verify nonce + capability, sanitize input, then redirect with a query arg notice.
Handle POST
if (isset($_POST['acme_save'])) {
check_admin_referer('acme_save_action');
if (! current_user_can('manage_options')) {
wp_die('Forbidden');
}
$title = sanitize_text_field(wp_unslash($_POST['title'] ?? ''));
// save...
wp_safe_redirect(add_query_arg('updated', '1'));
exit;
}