Title: wpcf7_before_send_mail hook error
Last modified: January 11, 2023

---

# wpcf7_before_send_mail hook error

 *  [Avinash Patel](https://wordpress.org/support/users/avinashdigitl/)
 * (@avinashdigitl)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/wpcf7_before_send_mail-hook-error/)
 * Hello When i try to run below code anywhere in functions.php file then it”s working,
   but when it’s not working inside action **wpcf7_before_send_mail **hook.
 * `if(is_user_logged_in()) {
   echo get_current_user_id();echo 'yes';} else {echo'
   no';}
    -  This topic was modified 3 years, 5 months ago by [Avinash Patel](https://wordpress.org/support/users/avinashdigitl/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwpcf7_before_send_mail-hook-error%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

The topic ‘wpcf7_before_send_mail hook error’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [contact_form_7](https://wordpress.org/support/topic-tag/contact_form_7/)

 * 0 replies
 * 1 participant
 * Last reply from: [Avinash Patel](https://wordpress.org/support/users/avinashdigitl/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/wpcf7_before_send_mail-hook-error/)
 * Status: not resolved