You know the id of the form from the shortcode, you can do stuff just for that particular form. Here’s some sample code for that, just replace $myform_id
with your form id:
add_action( 'wpcf7_mail_sent', 'wp190913_wpcf7' );
/**
* Do stuff for my contact form form. This function shouldn't return aything
*
* @param WPCF7_ContactForm $contact_form wpcf7 object, passed by refference
*/
function wp190913_wpcf7( $contact_form ) {
// Not my desired form? bail
if ( $contact_form->id !== $myform_id )
return;
// Do stuff for my contact form
}
Related Posts:
- What is the condition to check if we are in admin or frontend?
- Actions, functions and conditionals
- if (is_page(**PAGE ID**)) not working
- is_home , is_front_page not working
- What is the correct method for determining ‘is_front_page’ when using filters such as ‘pre_get_posts’ and ‘posts_where’?
- how to check if front page is set to show a static page
- Way to check if we are in Theme Customizer mode? [duplicate]
- Conditional tag for all categories of a custom post type
- is_home() vs is_archive()
- Blog Posts vs Static Page (conditional statements)
- Adding Controls to Theme Customizer If Certain Page Template is Active
- Problem with “conditional tag”: if empty
- Make specific tag visible only to logged in users in front-end
- How can I achieve something like has_post_format( ‘standard’ )?
- Issue getting gettext to work with conditional statements
- Need help with else if statement
- WordPress conditionals not working
- wp_head hook by page ID [closed]
- Cannot Use is_single() and is_admin in functions.php
- Hide a template part when page is password protected?
- Checking whether template part is loaded in a page
- Conditional tags inside a class
- Display Footer Shortcode Different for Logged In Users
- Use slug rather than id for $post->post_parent?
- If Parent or Current Page Is, Then Statement?
- Identify a Woocommerce page by WordPress conditional tags
- is_page conditional question
- Trouble with parent and child conditional tag to show content
- A simple method for disabling WPML language switcher when meeting specific circumstances [closed]
- Display a div only in some author’s single posts
- What do I add to this code to include additional CPTs?
- Loading template parts conditionally in Customizer
- Conditional IF statement not returning true even though echo of $user->province is correct
- is_front_page not working at all in any of the themes .php files
- add styles if custom header was included
- Check if user registered more than a month ago
- PHP if statement printing the if parameters
- Why is this is_page conditional not working?
- Conditional tags not working
- How to check with is_page if 404.php is loaded?
- Sub-category single post styling?
- I need use is_single in functions.php
- do code if current url = value
- Why might conditionals not work on a page?
- Conditional display faults
- Is there any way to assign stylesheets to whole sets of pages using is_page( )
- is_home() returns true while it shouldn’t
- Conditional tags help (if none, don’t display anything)
- How to display a feature only if custom field value is set?
- Additional conditions tags to work
- Gravity Forms, multiple conditions in shortcode
- Can this code be concatenated?
- Conditonal tag or work around to identify page number of pagnation
- Conditional: current user updated post in the last X days
- How can I get $pagenow equals to the Home Page or specific page on my site?
- Three variables on conditional tags
- Is it possible to If statement “article already appears on page”?
- How to use the conditional homepage tag
- If less than IE9 [closed]
- Cannot retrieve active members only
- Else statement not triggering after a failed if statement
- Custom Function for Portfolio Archive Template With Conditonal Tag
- Conditional Custom Image Header
- Trying to place shortcode/css/html into an IF conditional statement
- Will multiple conditionals slow down page load?
- conditional statement for profile pages
- Conditional single.php statement not recognizing conditionals
- WP newbie: using else/if statements to show multiple headers. bonks
- Conditional tag-like function to tell if post is in trash?
- Conditional Tags and Echo HTML / divs or CSS and Display: none?
- Getting false for is_home() on Posts page
- Automatically insert H2 on h2 tags on WordPress post
- Get value in TCPDF
- Content visibility condition based on date
- Add an identifier to a set of pages to access using a conditional tag
- How to target a search result page?
- Why is_page() returns false when visiting the static page declared as “posts page”
- if is NOT custom post type OR is NOT page combination [closed]
- Conditional tags returning different results for different areas on a page?
- Displaying message if no posts in tag
- WordPress Conditionals Giving Me A Headache
- PHP inside echo HTML?
- Conditional statements in wordpress themes
- Is this a bad approach to add conditional comments to wp_head?
- Help with if else statement for separating content from image attachment
- How to check if the current page’s parent is one of 2 different ID’s
- Showing code only on Front Page “Posts Page”
- Run a php function if a predefined page is visited
- Targeting all pages except top level pages
- nested conditional to check for feature image and custom field?
- Display Latest Post on a Page Conditionally
- is_archive for custom tax archive page?
- Help with adding conditional title tags to header.php
- How to apply style to the body tag of a particular page?
- Conditional statement with three condition
- if is_page(‘slug’)
- How do I combine these two conditionals? [closed]
- hide block of code from showing on certain pages
- Delete backgound for ID with conditional if statement
- Quick Conditional Tag Question if elseif [closed]