Return Path in wordpress

1

I set up the wordpress wp-mail function responsible for sending emails to the site through the form. If the wordpress update do I have to do this code addition again in the function?

    
asked by anonymous 06.04.2017 / 01:30

1 answer

1
  

If the wordpress update do I have to do this code addition again in the function?

If WordPress updates your edits will be lost , it is not a good practice to change the files of core (nothing outside the wp-content folder).

How to resolve?

The function wp_mail() is of type pluggable ", as the filename says. This means that it only runs in the original if another function is not specified with the same name.

// wp-includes/pluggable.php' linha 142 no WP 4.7
if ( !function_exists( 'wp_mail' ) ) :
    function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() )

So just create a new function called wp_mail() in a plugin or mu-plugin , with your custom code - which can be an original copy with your change - and its version will be used in the place of the original.

    
06.04.2017 / 01:59