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 a WordPress Plugin Settings Page Creating a Plugin Settings Page

Why is my code for the challenge not working? This is the part where I add the plugin menu to the admin area.

The problem is on step 3. I create the function declared in step 2. The instructions do not ask me to check if the current_user_can manage options. I tried commenting that out and it says now the code in step 1 is failing. With that code included, it just says Bummer - it doesn't work. The only thing I can think is that I should have used dashes instead of underscores somewhere.

Here is the code that seems to do exactly what is requested. function my_plugin_options_page() {

if( !current_user_can('manage_options')) {
wp_die('You do not have sufficient permissions to access this page.');

}

echo '<p>Welcome to my plugin settings page.</p>'; }

What could be wrong? Thanks, Bruce

Juliette Tworsey
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,425 Points

This is a case of the app being too picky. Technically you are correct, but you are not being expressly prompted to create anything other than the my_plugins_options_page function + the echo statement itself.

Take this part out:

if( !current_user_can( 'manage_options' ) ) {

        wp_die( 'You do not have suggicient permissions to access this page.' );

    }

Then it should pass. This had me stumped too:-)