Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Remove the email and name fields for logged-in users
- * @return array
- */
- add_filter('site-reviews/review-form/fields/normalized', function (array $fields) {
- if (is_user_logged_in()) {
- return array_filter($fields, function ($field) {
- return !in_array($field->path, ['name', 'email']);
- });
- }
- return $fields;
- });
- /**
- * Remove the email and name validation for logged-in users
- * @return array
- */
- add_filter('site-reviews/validation/rules/normalized', function (array $rules) {
- if (is_user_logged_in()) {
- unset($rules['name']);
- unset($rules['email']);
- }
- return $rules;
- }, 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement