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 trialthomas mery
901 PointsStuck at Wordpress Plugin course Code Challenge
Hi,
I'm stuck at Code Challenge task 2 for the Wordpress plugin course
https://teamtreehouse.com/library/creating-a-plugin-settings-page-2
the system throws an error but I don't understand why as the code I wrote seems to be exactly what is asked:
add_action('admin_menu', 'my_plugin_options_page');
prompt says : second argument of add_action should be my function name ...
well seems like it is
can you help?
thanks a lot
2 Answers
Ash Scott
435 PointsThe prompt saying 'second argument of add_action should be my function name' is the clue here. The add_action();
is correct, you just need to have the second part, in your case my_plugin_options_page
to be name of the function. In the challenge the function is named my_plugin_menu
so your action should be:
add_action('admin_menu','my_plugin_menu');
The code which checks your challenge is correct, assumes you haven't changed the function name, so if you have, change it back :)
Kind regards, Ash
thomas mery
901 Pointsthanks a lot Ash,
got confused with the name of the function that will actually create the option page
solved now
thomas