Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
    
Thanks for that Ashfame! Good stuff, I'll check into it all. –  Noel Tock Mar 20 '11 at 20:03
    
Happy to help! :) –  Ashfame Mar 20 '11 at 20:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.