WordPress: Add custom add_filter for custom functions

You can use the apply_filters function: function koku_crm_send_sendgrid($sendgrid_api_key, $to, $subject, $text, $html) { $to = apply_filters( ‘koku_crm_send_to’, $to ); $sendgrid = new \SendGrid($sendgrid_api_key); $mail = new KCSendGrid\Mail(); $from = new KCSendGrid\Email(get_bloginfo( ‘name’ ), get_bloginfo( ‘admin_email’ )); $mail->setFrom($from); $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, ‘UTF-8’)); $content = new KCSendGrid\Content(“text/plain”, $text); $mail->addContent($content); $content = new KCSendGrid\Content(“text/html”, $html); $mail->addContent($content); $personalization = new … Read more

Attach a external file as attachement using wp_mail

You can’t attach from a URL. So https://ucarecdn.com/8aa17c61-bd55-4311-8b45-7d9a2efde6c5/ won’t work. You need an absolute path to the file, such as /path/to/my/file.ext. But there are some other problems with your code snippet as well. You use $email_attachement (with a ..chement…) in one place, but then $email_attachment in your wp_mail() call. Also, your “attachment” isn’t a file. … Read more

Send email with list of active plugins upon activation/deactivation

If you look here in /wp-admin/includes/plugin.php do_action( ‘deactivated_plugin’, $plugin, $network_deactivating ); } } if ( $do_blog ) update_option(‘active_plugins’, $current); if ( $do_network ) update_site_option( ‘active_sitewide_plugins’, $network_current ); The options aren’t updated until after the hook fires. You can get around this by using the first parameter to deactivated_plugin: function detect_plugin_change( $plugin, $network_activation ) { $url … Read more

Send admin new order email to logged in user as well

What you have makes sense, except that your variable names dont match. You have $object in your function definition and in the function code you are trying to use $order. Adjusted: /* SEND ADMIN E-MAIL TO LOGGED IN USER */ /* — */ add_filter( ‘woocommerce_email_recipient_new_order’, ‘your_email_recipient_filter_function’, 10, 2); /* Add parents e-mail address to new … Read more

WordPress email could not be sent

The most common reason for this is that your WordPress hosting server is not configured to use PHP mail() function. How to configure your mail with wordpress and here is smtp plugin link

Change email address change notice from WordPress

To filter the content of the email sent when a user’s email is changed you want the email_change_email filter. Docs at https://developer.wordpress.org/reference/hooks/email_change_email/ Password change email is filtered by password_change_email, docs at https://developer.wordpress.org/reference/hooks/password_change_email/ You’ll be able to search to find examples of how to use these. You’ll need to add code to your functions.php or to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)