Depending when you’d like to take the action you should change the hook – I’ve chosen wpcf7_before_send_mail
– your function
function wpcf7_cstm_function($contact_form) {
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();
if ($submission) {
$posted_data = $submission->get_posted_data();
$txt = isset($posted_data['txt'])?$posted_data['txt']:'';
$text2 = isset($posted_data['txt2'])?$posted_data['txt2']:'';
$radio = isset($posted_data['radio'][0])?$posted_data['radio'][0]:'';
// do something with your data
}
}
add_action("wpcf7_before_send_mail", "wpcf7_cstm_function");
Explanation: radio buttons (like checkboxes) are returned in a form on an array. Radio values are one-element arrays, so you retrieve them by accessing the first element of the array. For checkboxes you’d have to iterate over the whole returned array to get all the values.
Related Posts:
- How to find the output of contact form 7 shortcode? [closed]
- Contact Form 7 from adding paragraph and break tags to HTML emails [closed]
- How to display a value from a radio button in the options menu in wordpress
- Attaching a pdf to Contact Form 7 e-mail via functions.php [closed]
- How to display posts by current user in a drop down
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Click a radio button must set textfield value
- Download PDF after CF7 form submission
- Contact Form 7 – Replace database configured form template with a static file
- Export Form Data to a CSV then send it as an attachment – contact form 7
- Sorting dynamic select/dropdown for Contact Form 7 of Modern Tribe Events posts
- Using CFDB7 vs Custom MySQL Database [closed]
- Pass get data from anchor URL [closed]
- Contact Form 7 WordPress, checking a few fields, if empty then invalid
- Add custom HTML data to Contact Form 7 mail?
- How to use Contact Form 7 shortcode value in a page?
- Send foreach $_post method to contact form 7 [closed]
- Check radio get value to array
- Import and use a variable in additional settings of Contact Form 7 [closed]
- Saving User Input to PHP Variable
- Submit cf7 form to cfdb as pdf/BLOB [closed]
- Contact form with dynamic dropdown and filter
- How can I save a user’s Contact Form 7 inputs as separate columns in a custom WordPress table?
- How does printf( __( ) ); work?
- Return HTML Template Page with PHP Function
- Displaying Logged-In User Name in WordPress Menu
- Change the filename format of saved featured images
- Getting the comment number relative to all the post’s comments
- How do I add a php statement to a jQuery string
- Upload images and attachments from frontend form
- Config apple-app-site-association file with wordpress
- How to use the php if statement [closed]
- lazy load comments wordpress on click
- Use Filename for Alt and Title Tags
- Should I use wp_mail or PHP’s mail? [duplicate]
- Trying to use Ternary operators with WP Conditionals
- Strip Image Classes from HTML Output
- Additional image sizes are not being generated
- Problem with WordPress Ajax form
- Header has extra HTML block at top before my code
- Strange wordpress slowness
- Global variable $post returning incorrect object
- how to make separate field in wordpress user_data_
- Where to edit the template that is generating the code for dynamic_sidebar left-sidebar in the Understrap theme? [closed]
- Get rid of this Strict Standards warning [closed]
- Custom search results page not working with empty search
- Image upload via FormData API and AJAX is not working ($_FILES always empty)
- Tax query in pre_get_posts not working
- how to fix error “called incorrectly, should not be accessed directly”?
- Validation algorithm in checkout field
- If has $title in widgets
- How to replace file_get_contents() with a WordPress Filesystem call
- get href content [closed]
- Warning: Attempt to read property “ID” on null in D:\xampp\htdocs\yba\wp-content\themes\young-brand-child\functions.php on line 162 [closed]
- Problem with AJAX in wordpress plugin
- Trouble inputting variable into WP query
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- How to say if meta_value is greater than 0 in an array?
- My website is not showing Footer section
- Listing titles and custom fields of entries within subcategories
- Best Way to Change a String in a WordPress Post
- WordPress site with embedded menu – gives You don’t have permission to access /wp-content/themes/xxx/taxonomy-redirect.php on this server
- Show get_sub_field value if it exists [closed]
- How to Display a List of Child Pages For a Parent Page in WordPress
- How to add PHP pagination to wordpress
- MySQL Query Returns Array () In Shortcode
- array wordpress when get is null
- Custom search query on WordPress page not working
- User meta needed in query is serialized – how to unserialize safely?
- PHP calling AJAX function that relies on passed PHP function values not working
- Order by title Child Pages displayed in a Parent Page
- how can I call a function when time expire
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Intermittent problem can the debug log give any clues?
- Filter by Post Type
- Updating the database after parsing CSV document
- Need help to create WordPress page that decodes a text file and publishes it in JSON format
- My blog posts section seems to be rendering the other blog posts inside the first? :/
- How to get total gross revenue for current month in the woocommerce dashboard status widget
- PHP is_embed error showing up
- How fix error in the WordPress loop?
- Run code before WordPress loads and insert data into WP if need be
- Use WP_Query Data In Cookie
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- Is custom behaviour possible when asynchronously uploading?
- How can I show only if custom field has content [closed]
- need help to arabic text in wordpress
- Sorting Meta Fields?
- Themes with variable width or single columns? I want to display source code
- Category List in Theme Options Page
- Keeping the previous get value and add another value when submitted
- Pagination not displaying
- upload images on front by user using form
- Masking external links with internal link for member-only
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- Custom taxonomy with page post type – WordPress