I haven’t tested this but you could try and use CF7’s wpcf7_form_hidden_fields and add this to the end of your ipgeolocation() function – then leave the form tag function as is but replace the hardcoded value with $country.
// Update Contact Form 7 hidden field
add_filter( 'wpcf7_form_hidden_fields', function( $hidden_fields ) use ( $country ) {
$hidden_fields['user_country'] = $country;
return $hidden_fields;
} );
Related Posts:
- How to make a image-size selected by default in Media upload – WP v3.5
- Apply class to every paragraph that holds image?
- Remove “Insert from URL” link in Media upload – WP 3.5
- static variable loop not working in WordPress
- adding a filter to a shortcode?
- Set media upload attachment link to none and hide it in WP v3.5
- How to automatically apply woocommerce product title to all product images alt tags?
- Change the footer text on the login page
- add_filter to post-gallery and remove all ‘s?
- How to make an meta_query optional?
- How to overwrite youtube embed?
- Rewriting search and pagination base
- Check if page parent has certain template
- Change comments form title on a page by page basis
- Add custom field to attachments in a specific category
- Remove class that has been added by parent theme
- How can update custom meta for all posts
- How do I know what variables are passed in a filter/action and what their meaning is?
- Why do filters/actions require an argument count?
- How to use return in my custom function instead of echo
- Run a filter when a walker runs
- Handling Body class based on Template
- Get_avatar filter?
- Add a class to the anchor tag on HTML5 gallery
- add_action shortcut?
- Passing the custom field values in the wp_get_current_user array function
- How can I remove a function that has been added to wordpress with add_filter?
- How to control WordPress image metadata (using Imagick)?
- How do I add custom bulk actions to multiple custom post types?
- Add data attribute to each li in menu
- Removing “wpautop” (auto tags) only on certain pages?
- Firing schema via code in functions.php doesn’t work
- Print last modified date only on posts
- WordPress Gravatar filter is removing my custom attributes
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Unique icons next to each WordPress menu item
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Trying to retrieve post meta
- Redirect to another page using contact form 7? [closed]
- Alter required message using comment form api
- Add item to top of menu using a filter in functions.php
- Which PHP page is the Default Posts Page
- How to make modifications only to certain elements of an HTML string on the server-side?
- Override a function defined in wp-includes/comment-template.php
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- Filtering a function’ output for a new continued function
- WP All Import / Update stock quantity from multiple XML files
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- Custom query vars filters problem with pagination
- Get the name of menu item with wp_nav_menu
- How to add data to a custom field at the wp_users table?
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- How to add aria role and schema markup to custom walker container
- Must filter functions receive all arguments passed to them?
- Hide a div when a custom field is empty
- Conditional On custom field plugin metabox
- User filter posts by year
- Delete images from media library when user deletes an image from ACF Gallery
- Updating Metadata with Shortcode
- Products listing check if meta checkbox is checked
- Trying to update Woocommerce meta values
- Is it possible to update the dataset using update_post_meta
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- Block error message in foreach loop when looping through ACF field
- Apply function.php filter only if url not has /amp/
- Hide a div if the fiels is empty
- Change lost password url to a mailto URL in WordPress
- Remove span tags from WooCommerce Downloads page
- How to bind each “the_content” elements to a custom variables
- How do I get the value of a current user’s custom field?
- Reload page with a different shortcode when a user selects from a dropdown
- WordPress Ajax filter: Create two loops for different output styles?
- Custom Bulk Actions handler not firing
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- How to generate customized filtered output for the gallery
- How to remove title tag with this filter
- str_replace not preserving whitespace
- Woocommerce Price Text
- Limit Taxonomy Parents
- Display a post based on its metabox selection
- Custom field in title
- Search box background on a different page template
- Display a list of users with avatar filterable with alphabets
- Display custom meta box in my template file
- ACF Date fileds to Age Convert [closed]
- AJAX: WordPress filters inside $html do not work as intended
- Appending an ACF custom field to the page title
- Assign new post author IF another user in custom field on post transition
- Add attribute to featured image with filter (wp_get_attachment_image_attributes)
- How to add different menu items on different menus?
- Custom Admin Menu Report for Specific User ID
- Add text below WooCommerce short description if metabox value is true
- ACF number less than comparison not working
- Is there a hook that I can use when a fatal error occurs?
- Unable to logout correctly after wp-login file was modified
- Adding Author Filter to CPTs
- How can I display formatted content using the_content filter?
- Exclude function for custom pages, exclude custom ACF fields