Best way to retrieve and show data from API to WordPress

Question

Basically, Our Vendor has a system developed in Yii 1.1, Which provides us data through multiple APIs. I am calling 5 different APIs on homepage, and using foreach loop to display the data on homepage. Google speed test and analytics shows 26-30+ seconds to load the website. I have limited 10 posts for each API on home page. Similarly I’m using same APIs on other wordpress pages as well where it loads all posts.

TO improve speed of website, I’m calling API to save the data to Json file, then calling the function which on homepage 5 times for each API which reads the json file and displays the data. It has improved the speed as well to 4-5 seconds. I have a cron job which runs at backend and updates the json files. Website speed is improved alot, But still google page speed and google analytics shows 25+ seconds for home page load time.

Is there a better way to do it?
Should I save the data from API to my wordpress custom post type and then display on frontend?
Should I get copy of database and display post on my frontend? If So Can I use multiple databases in WordPress?

0
, Asfandyar Khan 3 months 0 Answers 53 views 0

Leave an answer