Support » Plugin: Post SMTP Mailer/Email Log » PHP Warning if wp_mail overriden in mu-plugin

  • On wp-content/plugins/post-smtp/Postman/Postman.php:321, I suggest you replace:

    
    $plugin_file = $output_array[1];
    $plugin_data = get_plugin_data( $plugin_full_path );
    
    $deactivate_url = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=active&paged=1&s=deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a><br>';
    $message .= '<br><strong>Plugin Name:</strong> ' . $plugin_data['Name'];
    $message .= '<br>' . $deactivate_url;
    

    With:

    
    if (array_key_exists(1, $output_array)) {
        $plugin_file = $output_array[1];
        $plugin_data = get_plugin_data( $plugin_full_path );
    
        $deactivate_url = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=active&paged=1&s=deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a><br>';
        $message .= '<br><strong>Plugin Name:</strong> ' . $plugin_data['Name'];
        $message .= '<br>' . $deactivate_url;
    }
    

    (Just wrapped it in a if (array_key_exists(1, $output_array)) {} check)

    So that, when overriding wp_mail through a mu-plugin, it doesn’t throw a PHP warning like this: https://pastebin.com/iz1jjV5w

    Thanks,
    Lucas

  • The topic ‘PHP Warning if wp_mail overriden in mu-plugin’ is closed to new replies.