• Hello,
    I was trying to modify the tag replacements for emails. The problem is that the acceptance-tag also includes sometimes the complete label text.
    So I created a function to replace the label text with nothing, to only have the basic output.
    There is no error message but the email is not send. Did anyone have some suggestions why this is not working?

    When I try to only use one string ($replaced = str_replace('string 1', '', $replaced) it is working as excpected.

    This is my code:


    add_filter('wpcf7_mail_tag_replaced',
    function ($replaced, $submitted, $html, $mail_tag) {
    /*
    $searchArr = [
    'string 1',
    string 2',
    .....
    ];
    */
    return str_replace($searchArr, '', $replaced);
    },
    10, 4
    );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter yfain

    (@yfain)

    Hello,
    I was trying to modify the tag replacements for emails. The problem is that the acceptance-tag also includes sometimes the complete label text.
    So I created a function to replace the label text with nothing, to only have the basic output.
    There is no error message but the email is not send. Did anyone have some suggestions why this is not working?

    When I try to only use one string it is working as excpected.

    add_filter('wpcf7_mail_tag_replaced',
    function ($replaced, $submitted, $html, $mail_tag) {
    return str_replace('string1, '', $replaced);
    },
    10, 4
    );

    My regular code:

    add_filter('wpcf7_mail_tag_replaced',
    function ($replaced, $submitted, $html, $mail_tag) {
    $searchArr = [
    'string1',
    'string 2',
    ......
    ];
    return str_replace($searchArr, '', $replaced);
    },
    10, 4
    );
    • This reply was modified 2 weeks, 3 days ago by yfain.
    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.