Title: PHP Notices
Last modified: August 24, 2016

---

# PHP Notices

 *  [Ryan Tvenge](https://wordpress.org/support/users/rtvenge/)
 * (@rtvenge)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/php-notices-42/)
 * Not a huge deal, but I was getting some notices in my local environment due to
   undefined array keys. I depressed them by adding some conditionals. I’m not sure
   if this it the best way to fix the issue, but it seemed to work:
 * line 130-136
 *     ```
       $title = array_key_exists('title', $instance) ? esc_attr($instance['title']) : false;
       $post_type = array_key_exists('post_type', $instance) ? esc_attr($instance['post_type']) : false;
       $orderby = array_key_exists('orderby', $instance) ? esc_attr($instance['orderby']) : false;
       $maxlines = array_key_exists('maxlines', $instance) ? esc_attr($instance['maxlines']) : false;
       $pformat = array_key_exists('pformat', $instance) ? esc_attr($instance['pformat']) : false;
       $desc = array_key_exists('desc', $instance) ? esc_attr($instance['desc']) : false;
       $trunc = array_key_exists('trunc', $instance) ? esc_attr($instance['trunc']) : false;
       ```
   
 * The notices were:
 *     ```
       Notice: Undefined index: desc in /srv/www/standarddistributing/htdocs/wp-content/plugins/custom-post-type-list-widget/custom-post-type-list-widget.php on line 135
       Notice: Undefined index: trunc in /srv/www/standarddistributing/htdocs/wp-content/plugins/custom-post-type-list-widget/custom-post-type-list-widget.php on line 136
       ```
   
 * Just thought I’d throw the fix out there. Everything else seems to work great!
 * Thanks for the plugin!
 * [https://wordpress.org/plugins/custom-post-type-list-widget/](https://wordpress.org/plugins/custom-post-type-list-widget/)

The topic ‘PHP Notices’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-post-type-list-widget.svg)
 * [Custom Post Type List Widget](https://wordpress.org/plugins/custom-post-type-list-widget/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-list-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-list-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-list-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-list-widget/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Ryan Tvenge](https://wordpress.org/support/users/rtvenge/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/php-notices-42/)
 * Status: not resolved