Description
Adds a custom Oops! We could not locate your form.roles attribute to the shortcode that restricts the rendered form to users with one of the specified WordPress roles. Logged-out users and users without a matching role see a fallback message instead of the form.
Usage Notes
- Use the shortcode like
— comma-separated role slugs.Oops! We could not locate your form.
- Returns the original shortcode output untouched when the
rolesattribute is omitted, preserving default behavior. - Server-side check only; the form HTML is never sent to unauthorized users, but URL-based form submissions are not blocked. Pair with
gform_pre_submission_filterif you also need to prevent direct submissions.
Resources
Code
Please log in to view this code snippet.