Support » Plugin: Social Media Widget » NOTICE: Undefined index: filter

  • I got this notice / error :
    NOTICE: wp-content/plugins/social-media-widget/social-widget.php:443 – Undefined index: filter

    Changing this :
    echo "<div class=\"socialmedia-text\>" . $instance['filter'] ? wpautop($text) : $text . '</div>';
    to this :
    echo "<div class=\"socialmedia-text\>" . $text . '</div>';

    removed the notice.

    If I change this would that break specific functionality of the plugin ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • When WP-Debug is turned on the following error shows above the icons in the widget area of the sidebar:

    Notice: Undefined index: filter in /www/zendsvr/htdocs/news/wp-content/plugins/social-media-widget/social-widget.php on line 443

    Same problem, but in our case only showing when Debug is on.

    Notice: Undefined index: filter in \wp-content\plugins\social-media-widget\social-widget.php on line 443 in version 4.0.2.

    This error occurs because the code that causes the error is borrowed from the WordPress Text widget. It’s the checkbox that says “Automatically add paragraphs” which (like the checkbox says) automaticly adds paragraphs to the text.

    However the checkbox was not borrowed, so like Twanneman stated changing the code on line 443 of \wp-content\plugins\social-media-widget\social-widget.php to:

    echo "<div class=\"socialmedia-text\>" . $text . "</div>";

    is the cleanest solution.

    Note to the plugin developer:
    The code for the form of the “Automatically add paragraphs” checkbox (in WordPress 3.9.1) can be found in \wp-includes\default-widgets.php on line 528:

    <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> /> <label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>

    and the code to save the value can be found on line 514 of the same file (\wp-includes\default-widgets.php):

    $instance['filter'] = isset($new_instance['filter']);

    Please update this plugin, because we use it regularly.

    Thanks in advance! 🙂




    The clean solution should be:

    echo "<div class=\"socialmedia-text\">" . $text . "</div>";

    I forgot to close the class attribute in my post above.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘NOTICE: Undefined index: filter’ is closed to new replies.