Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional WordPress validation rules #165

Open
BenRutlandWeb opened this issue Oct 26, 2021 · 1 comment · Fixed by #166
Open

Additional WordPress validation rules #165

BenRutlandWeb opened this issue Oct 26, 2021 · 1 comment · Fixed by #166
Assignees
Labels
enhancement New feature or request

Comments

@BenRutlandWeb
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
There are many WordPress specific reasons to validate user input, it would be nice to have some more validation rules in the framework core.

Describe the solution you'd like
Among other rules the following would be a nice addition:

  • EmailExists - determine if the email already exists: email_exists($email) !== false
  • UniqueEmail - determine if the email is unique: email_exists($email) === false
  • UsernameExists - determine if the username exists: username_exists($username) !== false
  • UniqueUsername - determine if the username is unique: username_exists($username) === false
  • IsUuid - is a valid UUID: Str::isUuid($uuid)
  • PostTypeExists - determine if the post type exists: post_type_exists($post_type)
  • TaxonomyExists - determine if the taxonomy exists: taxonomy_exists($taxonomy)
  • TermExists - determine if the term exists: (bool) term_exists($term)

Describe alternatives you've considered
I can create custom rules but this is repetitive for multiple projects.

Additional context
There are probably more useful rules, and perhaps the Exists and Unique rules can be made reusable instead of strictly for the email/username

@BenRutlandWeb BenRutlandWeb self-assigned this Oct 26, 2021
@BenRutlandWeb BenRutlandWeb added the enhancement New feature or request label Oct 26, 2021
@BenRutlandWeb BenRutlandWeb linked a pull request Oct 28, 2021 that will close this issue
@BenRutlandWeb
Copy link
Collaborator Author

BenRutlandWeb commented Oct 28, 2021

IsFile and IsImage would also be good validation rules to implement. Perhaps reliant on #167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant