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_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
- give_donation_amount: the third parameter has been changed to
$payment_idinstead of payment object.
- give_get_donation_form_title: deprecated fourth parameter. the third parameter changed to
- 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
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.