I’m using an API which is accessed with ID/Secret, etc. and use it in different widgets. In each widget however, I’m repeating the entire JSON process (i.e. file_get_contents, decode, etc.). I can’t help but think this must be slowing the entire process down.
What would be the best way of going about only calling this API once and then grabbing various data from it in different widgets, theme components, etc.?
Thank you!
Noel
Use Transients API – http://codex.wordpress.org/Transients_API
I would also suggest you to use WordPress HTTP API – http://codex.wordpress.org/HTTP_API instead of
file_get_contents