I am learning WordPress development with a tutorial where we learn to create a widget,
it is asked to create a file named newsletterwidget.php with the following code, but it does not say in which folder to put it:

class Zero_Newsletter_Widget extends WP_Widget
    public function __construct()
        parent::__construct('zero_newsletter', 'Newsletter', array('description' => 'Un formulaire d'inscription à la newsletter.'));
    public function widget($args, $instance)
        echo 'widget newsletter';

So, as WP_Widget class is created in wp-includesclass-wp-widget.php, I decided to put newsletterwidget.php in wp-includes but I get the following error:

Fatal error: Class ‘WP_Widget’ not found in C:xampphtdocswordpresswp-includesnewsletterwidget.php on line 5

Thank you

Read more here: Class ‘WP_Widget’ not found


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: