Null causes trouble during further processing, i.e. PHP warnings in the API processing and later on problems building the dashboard widget in Javascript, because all methods expect the array to have all keys.
Move the caching (transient) directive into the conditional, so we still do not cache empty results and so not return NULL anymore.
Null causes trouble during further processing, i.e. PHP warnings in the API processing and later on problems building the dashboard widget in Javascript, because all methods expect the array to have all keys.
Move the caching (transient) directive into the conditional, so we still do not cache empty results and so not return NULL anymore.
This part will produce a couple of warnings, if
get_stats()
returnsnull
: https://github.com/pluginkollektiv/statify/blob/0ec5f693bc01f584a8c13f1ddb2911c79211e1ff/inc/class-statify-api.php#L127-L129And this part will fail: https://github.com/pluginkollektiv/statify/blob/0ec5f693bc01f584a8c13f1ddb2911c79211e1ff/js/dashboard.js#L161-L166