Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param array $fields
- * @param \GeminiLabs\SiteReviews\Arguments $args
- * @return array
- */
- add_filter('site-reviews/review-form/fields', function ($fields, $args) {
- $email = filter_input(INPUT_GET, 'email', FILTER_VALIDATE_EMAIL);
- if (!empty($email)) {
- // Set the input type of the email field to "hidden"
- if (false !== array_search('email', $args->hide)) {
- $args->set('hide', array_diff($args->hide, ['email']));
- $fields['email']['placeholder'] = '';
- $fields['email']['type'] = 'hidden';
- }
- // Set the value of the email field
- $fields['email']['value'] = $email;
- }
- return $fields;
- }, 10, 2);
Add Comment
Please, Sign In to add comment