Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Storing Instagram JSON feed in WordPress options table

I am having issues storing the Instagram access token and json feed in a serialized WordPress options table. Everything seems to be stored correctly, but when I use get_option() to retrieve the data, it returns a string containing the letter 'a'. Any ideas?

Notes:

  1. I am using base64_encode() to secure the data and base64_decode() to unencrypt it on the return. However, the issue has existed since before I used this method.
  2. The Instagram access token does include periods (full stops) in the string.

Are you creating a plugin? If so, would you be able to provide me a download link so I can install and give a shot at figuring this out for you?

Here is my working version. Previously I was trying to include the JSON feed in the same wp_option row as the access_token. Still not sure why that doesn't work. https://dl.dropboxusercontent.com/u/13611436/instagram-feed.zip

5 Answers

Here is a link to the table row with the json included: http://pastebin.com/jZEZMbac I have since removed the json from the row and calculated it on each page load. Any idea why the json would make get_option() return as a string?

Colin Lewis
Colin Lewis
9,021 Points

I was going to take a look, but the zip in invalid, I can't open it to look at your code.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

What does it look like in the DB when you first save it (using something like phpMyAdmin to look at the DB directly? Sounds like you're getting back a weird snippet of the serialized array.

Anthony Moore
Anthony Moore
2,282 Points

What does the full code look like when trying to show the instagram images?