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

velochicdunord
velochicdunord
4,816 Points

Error code when adding options to My First Menu exercise.

Am reviewing the exercise at https://teamtreehouse.com/library/creating-a-plugin-settings-page-2, which requires you to add the add_options_page items to function my_plugin_menu.

Am getting an error message "syntax error, unexpected ',' in plugin.php on line 5", with the following code:

function my_plugin_menu() {
  add_options_page(){
    'My Plugin Settings Page',
    'My Plugin',
    'manage-options',
    'my-plugin-menu',
    'my_plugin_options_page'
  }

Also, for the Treehouse dev team, the order in which parameters are requested to be input isn't consistent with the instructional video starting this unit at https://teamtreehouse.com/library/how-to-build-a-wordpress-plugin/building-a-wordpress-plugin-settings-page/how-to-create-a-plugin-template-with-a-settings-page-2

Within the video, user access options are specified in the third item, while in the interactive exercise, they appear to be specified for the fourth.

velochicdunord
velochicdunord
4,816 Points

I fixed it - should have been: ...php function my_plugin_menu() { add_options_page( 'My Plugin Settings Page', 'My Plugin', 'manage-options', 'my-plugin-menu', 'my_plugin_options_page'); ...