Registration form

// Add this to your theme’s functions.php or in a plugin

// Register the shortcode: [custom_user_registration_form]
function custom_user_registration_form() {
ob_start(); ?>




}

if (!is_email($email) || email_exists($email)) {
$error->add(’email_error’, ‘Invalid or already registered email.’);
}

if (empty($password) || strlen($password) < 6) { $error->add(‘password_error’, ‘Password must be at least 6 characters.’);
}

if (empty($error->errors)) {
$user_id = wp_create_user($username, $password, $email);
echo ‘

Registration successful. You can now log in.

‘;
} else {
foreach ($error->get_error_messages() as $message) {
echo ‘

‘ . esc_html($message) . ‘

‘;
}
}
}

return ob_get_clean();
}
add_shortcode(‘custom_user_registration_form’, ‘custom_user_registration_form’);

Shopping Cart