Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Set the assigned_posts value from an URL parameter (?assigned_post=)
- * Example: https://domain.com?assigned_post=4
- * @param array $fields
- * @return array
- */
- add_filter('site-reviews/review-form/fields/hidden', function ($fields) {
- if (!isset($fields['assigned_posts']) || !isset($fields['assigned_posts']->field)) {
- return $fields;
- }
- if ($postId = intval(filter_input(INPUT_GET, 'assigned_post'))) {
- $fields['assigned_posts']->field['value'] = $postId;
- }
- return $fields;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement