{"id":12067126,"date":"2019-10-26T03:36:42","date_gmt":"2019-10-26T03:36:42","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/advice-on-using-contact-form-7-hook-2\/"},"modified":"2019-10-26T03:36:42","modified_gmt":"2019-10-26T03:36:42","slug":"advice-on-using-contact-form-7-hook-2","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/advice-on-using-contact-form-7-hook-2\/","title":{"rendered":"Advice on using contact form 7 hook"},"content":{"rendered":"<p>Hi,<br \/>\nI have written the following codes:<\/p>\n<pre><code>\n\/\/ define the wpcf7_mail_sent callback \nfunction action_wpcf7_mail_sent( $contact_form ) { \n    $temp1246 = get_post_meta( 1246, $key = &#039;ID&#039;, TRUE);\n    $temp1246 = intval($temp1246) + 1;\n    update_post_meta( 1246, &#039;ID&#039;, $temp1246 );\n}; \n         \n\/\/ add the action \nadd_action( &#039;wpcf7_mail_sent&#039;, &#039;action_wpcf7_mail_sent&#039;, 10, 1 ); \n<\/code><\/pre>\n<p>What the code does is that it will increment a page\u2019s custom value by 1 every time a contact form is submitted. But the problem I have now is that I only want a specific contact form to trigger this code when it is sent, not all the contact forms (I have a few contact forms in the site powered by CF7).<\/p>\n<p>May I know how can I adjust the codes above so that it is only triggered when the contact form (id = \u20181000\u2019) was sent for example?<\/p>\n<p>Appreciate if anyone can assist, thank you!<\/p>\n","protected":false},"template":"","class_list":["post-12067126","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12067126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12067126\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12067126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}