最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

shortcode - How to insert a short code into Contact Form 7 in Wordpress that will call a function once the submit button is pres

programmeradmin3浏览0评论

How (or where) do I insert a short code that will call a function (written in a plugin called 'code snippets') when the submit button is pressed. I am trying to get the submit button to send data to an external database instead of sending mail. I have the actual function written already but no matter where I place the short code nothing happens when the submit button is pressed. The external database lives on the same IP address as the wp database. I have been struggling with this short code for a bit of time now so thought I would pose the question.

How (or where) do I insert a short code that will call a function (written in a plugin called 'code snippets') when the submit button is pressed. I am trying to get the submit button to send data to an external database instead of sending mail. I have the actual function written already but no matter where I place the short code nothing happens when the submit button is pressed. The external database lives on the same IP address as the wp database. I have been struggling with this short code for a bit of time now so thought I would pose the question.

Share Improve this question asked Jun 20, 2019 at 17:16 Robin OlsenRobin Olsen 33 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

You can achieve it by changing the action of the particular form and then use the function to store the data in the database into a new file.

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url($url)
{
    global $post;
    $id_to_change = 1;
    if($post->ID === $id_to_change)
        return 'wheretopost.asp';
    else
        return $url;
}
发布评论

评论列表(0)

  1. 暂无评论