Give 2.1.0 – Performance Improvements

In Give version 2.1.0, we are updating a few functions and filter parameters to improve performance on both the frontend and backend of Give. The changes we’re making will improve page load time and also ensure your donations process more quickly and reliably.

To achieve this we’ve restructured how we retrieve data through the use of helper functions that utilize fewer SQL queries. As a best practice we recommend using Payment ID, Form ID, and Donor ID to retrieve meta data from the database rather than creating objects. This is because creating an object of the Give_Payment, Give_Donate_Form, and Give_Donor  classes, especially in loops, causes excessive SQL queries that run internally to set the object properties, many of which you won’t need to use.

Updated Filters in 2.1

  1. give_donation_amount: the third parameter has been changed to $payment_id instead of payment object.
  2. give_get_donation_form_title: deprecated fourth parameter. the third parameter changed to $payment_id.
  3. give_receipt_status_notice: fourth parameter deprecated.

Developer’s Note: If you are using above filters in your custom code you will get notices in debug.log if you will not update your code to use the new IDs rather than passing the object.

Along with the refactoring of existing functions we’ve added a few additional helper functions.

New Helper Functions in 2.1

  1. give_get_donation_address
  2. give_has_payment_gateway
  3. give_is_donation_completed
  4. give_get_payment_total

Faster and More Secure

Scaling Give is important to us and we’re continuing to explore ways to reduce queries and code inefficiencies throughout the entire ecosystem. If you have any recommendations, please feel free to reach out here or on GitHub.

 

Ravinder Kumar

Open source lover, the father of a daughter, continually improving developer, and Senior WordPress Engineer at GiveWP.

 

Leave a Comment