Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
WordPress Plugin Development

Creating Custom Admin Forms

Build custom admin forms with nonces, capability checks, and redirects.

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;
}

Leave a reply

Your email address will not be published. Required fields are marked *