Title: [Widget] When using WP_DEBUG: Undefined variable before_widget
Last modified: August 21, 2016

---

# [Widget] When using WP_DEBUG: Undefined variable before_widget

 *  [Marcoevich](https://wordpress.org/support/users/marcoevich/)
 * (@marcoevich)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/widget-when-using-wp_debug-undefined-variable-before_widget/)
 * Hi All,
 * I have just turned on WP_DEBUG to test something, and I noticed that one of my
   widgets, which is working fine btw, has thrown some errors:
 * > Notice: Undefined variable: before_widget in /wordpress/wp-content/themes/interio/
   > functions/widgets/widget-contactform-support.php on line 24
   > Notice: Undefined variable: after_widget in /wordpress/wp-content/themes/interio/
   > functions/widgets/widget-contactform-support.php on line 112
 * This is how I build my widget (which again is working fine):
 *     ```
       class Form_Widget_wpse_104728 extends WP_Widget {
       //Defining the widget
   
       function widget($args,$instance) {
           echo $before_widget;
   
       // Processing the form
            - Php code for sending email
       //The Form itself
            - HTML code for support form
   
           echo $after_widget;
       } //Ending function widget
       } //ending widget class
       ```
   
 * Is there anything wrong with the widget itself that could cause this error?
 * Thanks in advance! 😉

Viewing 1 replies (of 1 total)

 *  [Rahendra Putra K™](https://wordpress.org/support/users/rahendz/)
 * (@rahendz)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/widget-when-using-wp_debug-undefined-variable-before_widget/#post-4288962)
 *     ```
       function widget($args,$instance) {
   
           extract($args);
   
           echo $before_widget;
   
           // Processing the form
   
           echo $after_widget;
       }
       ```
   
 * make sure to extract arguments first to use sidebar configuration. hope it help.

Viewing 1 replies (of 1 total)

The topic ‘[Widget] When using WP_DEBUG: Undefined variable before_widget’ is closed
to new replies.

## Tags

 * [before_widget](https://wordpress.org/support/topic-tag/before_widget/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 1 reply
 * 2 participants
 * Last reply from: [Rahendra Putra K™](https://wordpress.org/support/users/rahendz/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/widget-when-using-wp_debug-undefined-variable-before_widget/#post-4288962)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
