Debugging faulty return $recipient;
-
Hi there!
First off, thank you for this plugin – great work!
I have an issue though, and the short question is: Can I get debug info about the returned value from the filter?
Long version of the question:
I’m trying to send a form to multiple recipients, but I can’t get it to work. I’ve figured out you can do this via commas, but it does not work with my filter.This is what I’ve got:
/** Set the contact form 7 recipients with a filter. * Separate multiple recipients with a comma (,). */ function wpcf7_dynamic_recipient_by_creator_mail($recipients, $args=array()) { $creators = get_field('product_creators'); $recipients = ''; $i = 0; foreach($creators as $creator) { $i++; $mail = get_field('creator_e-mail', $creator); $recipients .= $mail . ($i <= sizeof($creators)-1 ? ',' : ''); } //expected: //return '[email protected],[email protected],[email protected]'; return $recipients; } add_filter('wpcf7_creator_recipients', 'wpcf7_dynamic_recipient_by_creator_mail', 10, 2);
The expected return is what I get when I echo the code on any given page, so the data retrieval part works. The dynamic recipient also works when I return the hard-coded value (and the mail gets sent to all recipients). But when I return the
$recipient
variable instead,I get a “your mail could not be sent, try later” error.Now, my question is somewhere along the lines of: Can I get some debug info on what the return statement got? Because I can’t figure out why it does not work, because all single parts are working as they should.
Best Regards and thank you for your time,
Fabian
- The topic ‘Debugging faulty return $recipient;’ is closed to new replies.