• Hi there

    I’m trying to hack a plugin by insert a dynamic variable into a wp_mail()…

    The plugin initialize a send_to – variable with:

    $this->send_to = get_option( ‘woocommerce_product_enquiry_send_to’ );

    this is being used as follow:

    if ( wp_mail( apply_filters( ‘product_enquiry_send_to’, $this->send_to, $product_id ), $subject, $message, $headers ) )
    echo ‘SUCCESS’;
    else
    echo ‘Error’;

    I have created a function:

    function enquiry_to_vendor($email , $product_id ) {
    global $product;

    $vendors = get_product_vendors( $product->id );
    if( $vendors ) {
    foreach( $vendors as $vendor ) {
    $email = $vendor->paypal_email;
    }

    return $email;
    }

    }

    and applying add_filter:

    add_filter( ‘product_enquiry_send_to’, ‘enquiry_to_vendor’, 11, 2 );

    But I get nothing in the send_to field in the wp_mail() when do that add_filter – I have also tried to remove_filter() but with out luck…

    Has this to be done in another way since WP ver. 4.1.1 or am I missing something ?

    Cheers,
    Adam

The topic ‘add_filter hack is not working…’ is closed to new replies.