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 How to Build a WordPress Plugin Connecting WordPress Plugins with 3rd Party APIs Getting and Storing JSON Code Challenge

Brad Griffin
Brad Griffin
7,003 Points

I'm not even sure where to start with this challenge:


Write a function named "my_plugin_get_profile" with a parameter of "my_plugin_username"

I've rewatched some of the previous videos, but.... well.... honestly I'm lost on this one. Something tells me this example plugin should be a bit simpler :-) Should I stop and go watch a json and php video before attempting this challenge again, or can someone point me in the right direction? Thanks!

2 Answers

Hi Brad,

How is your PHP in general? It may be helpful to review some of the PHP lessons just to better familiarize yourself with creating functions and passing in parameters. As for this challenge, though:

function my_plugin_get_profile($my_plugin_username) {


The first part of the question is asking you to create a function called "my_plugin_get_profile" so the first thing you would do is start with the word function, followed by a space, and then my_plugin_get_profile with a set of parentheses. Now, in some cases depending on your function these parentheses may be empty, meaning you are not passing any parameters to it, however, in this case it is asking you to pass a parameter of my_plugin_username, so within the parentheses we add that.

A parameter (also called an argument) is just like a variable which is why you see the dollar sign in front of it. Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma.

Brad Griffin
Brad Griffin
7,003 Points

Thank you mikes02 !!! Seriously though, going from /how-to-build-a-wordpress-plugin/ to json api stuff is a bit of a friggin' stretch! I wrote and wrapped up a few simple plugins, but having all this extra hooplah in the "plugin" stuff is ......rough! :-)

Thanks for the help. On to the second part!

I understand, it can be very overwhelming, the key is to just take it a piece at a time and don't move along too quickly, practice and study the concepts, even from their simplest form, before moving on to more advanced subjects, it can be tempting to quickly move from course to course or subject to subject, but if you don't take the time to practice what you are learning and apply it in a meaningful way, you may not retain it as well in the future.