WordPress.org

Forums

Custom Post Type List Widget
Undefined index errors (3 posts)

  1. Mei Gwilym
    Member
    Posted 2 years ago #

    Hi,

    Not a major problem, but I was getting warnings for undefined indexes.

    I added the following lines

    if(empty($instance)) $instance = array('title' => '', 'post_type' => '', 'orderby' => '', 'maxlines' => '', 'pformat' => '', 'desc' => '', 'trunc' => '');
    		if(!isset($instance['desc'])) $instance['desc'] = 'false';
    		if(!isset($instance['trunc'])) $instance['trunc'] = 'false';

    on line 28 and 128, which stops the error messages.

    Mei

    http://wordpress.org/extend/plugins/custom-post-type-list-widget/

  2. Devin Price
    Member
    Posted 2 years ago #

    I'm getting the same errors. Fixed it also. Would be nice to have these changes in the plugin if you can get to it.

  3. Matthew Eppelsheimer
    Member
    Posted 2 years ago #

    +1

    My fix is essentially the same:

    $desc = $trunc = false;
    if ( !empty( $instance['desc'] ) )
    	$desc = esc_attr($instance['desc']);
    if ( !empty( $instance['trunc'] ) )
    	$trunc = esc_attr($instance['trunc']);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.