parse json object and display live in wordpress php widget

You have an arror because you do foreach loop on array, but one of value – also array, and you trying echo an array (articles).

  1. json_decode
    second parametr make your response as assoc array, if true or return object by default

  2. Use loop for each array in your data. I see that articles inside json – is array.

  3. Its not bad practice. But it`s can be slow.
  4. I think this might helps you with cahce troubles: click

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)