Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 902635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:44:56+00:00 2026-05-15T15:44:56+00:00

I would like to create a plugin that uses the contact form 7 hook,

  • 0

I would like to create a plugin that uses the contact form 7 hook, wpcf7_admin_after_mail. I want to use the plugin to interface with a CRM system. What I have thus far is the following:

//plugin header here

function add_to_CRM( $cf7 )
{
    if (isset($cf7->posted_data["your-message"]))
    {
        full_contact($cf7);
    } else {
        quick_quote($cf7);
    }
    return $cf7;
}

add_action('wpcf7_admin_after_mail', 'add_to_CRM');

//other functions here

I can’t seem to get this working. I can’t even get the hook to work and do something like mail me. Anybody have any idea what I’m doing wrong here. Since I have limited WordPress experience I might me missing the boat completely with what I’m trying to do here. I’ve Googled for answers to no end.

EDIT: I ended up adding this to the theme’s functions.php file and it works perfectly. Thing is, I want to get it working as a plugin. Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:44:57+00:00Added an answer on May 15, 2026 at 3:44 pm

    Try delaying the add_action() call, something like;

    add_action('init', create_function('',
        'add_action("wpcf7_admin_after_mail", "add_to_CRM");'));
    

    This actually registers your CF7 hook once WordPress is ready (which is nearer the time functions.php gets loaded in).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a modular(plugin-like) application that uses JPA as its persistence abstraction,
I would like to create a plugin for jquery that doesn't work with the
I would like to create wordpress plugin that will display quote of the day.
I would like to create a c++ type that mimic the build-in type exactly.
I would like to create a class that runs something (a runnable) at regular
I would like to create a virtual host in apache2, but I want it
I would like to create a blurry effect that will last e.g. 500 ms
I would like to create a search box component, similar to the one that
I'm looking to create the storyboard idea that oDesk uses on http://www.odesk.com/w/odesk_story I like
I would like to create the configuration editor plugin for my XML configuration file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.