Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress How to Build a WordPress Plugin Building WordPress Widgets, and Shortcodes WordPress Widgets Code Challenges

What do i do wrong on this piece of code i get a fail message

This is the code that i'am applying:

function widget( $args, $instance ) { // Widget output

        extract($args);
        $title = apply_filters('widget_title', $instance['title']);

    }

The code challenge keeps saying that the first thing to do is call the extract function. But i'am doing just that, so what is wrong with my code

plugin.php
<?php

    class My_Plugin_Widget extends WP_Widget {

        function my_plugin_widget() {
            parent::__construct( false, 'My Plugin Widget' );
        }

        function widget( $args, $instance ) {
        // Widget output

     extract($args);
      $title = apply_filters('widget_title', $instance['title']);

    }

      function update( $new_instance, $old_instance ) {
        // Save widget options

      $instance = $old_instance;

            $instance['title'] = strip_tags($new_instance['title']);

            return $instance;
    }

      function form( $instance ) {
        // Output admin widget options form

      $title = esc_attr($instance['title']);

            require('inc/widget-fields.php');
    }

    }



?>