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 Building WordPress Widgets, and Shortcodes Adding AJAX To Plugins on the Front-End

Adding Ajax to Plugins on the Front End, Code Challenge Task 3

I'm having trouble with this code challenge task. After some trial and error, I got the hint that I needed to include a third argument for an array of dependencies. I don't remember this being discussed at all, and I've looked through all the recent videos and can't find it. Can someone point me to the place where this concept was explained?

Also, when I do try to put any kind of array as the third variable [so far I've only tried array( 'jquery' ) ], it tells me to check the file path for the js file. I'm 90% sure I have that part right, because it works until I add the array.

Anyway, any insight would be appreciated. Thanks.

4 Answers

Chad Pjontek
Chad Pjontek
13,700 Points

There is not quite enough information regarding the file path in the question on this step. It is inferred from the previous step that it is in the my-plugin/js folder. The code should look like this:

wp_enqueue_script( 'my_plugin_frontend_js', plugins_url( 'my-plugin/js/front-end.js' ), array('jquery'), '', true );
lyonel scapino
lyonel scapino
14,191 Points

I am copy pasting this exact same code, which is the exact same code that I had written before and the challenges still gives me an error. I would appreciate the challenge editor to be checked upon.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hi, can you post up the code you're using for this. Thanks!

lyonel scapino
lyonel scapino
14,191 Points

I am copy pasting this exact same code, which is the exact same code that I had written before and the challenges still gives me an error. I would appreciate the challenge editor to be checked upon.

Zac,

When I ran the code challenge again to get my code for you, it all worked fine this time.

Thank you!

Hope

Richard Nash
Richard Nash
24,862 Points

Yes, ran into this as well. I don't remember the last bit of information being covered anywhere in the videos... thanks Chad :-)