Category Posts Widget
code improvement suggestion (2 posts)

  1. Dwenaus
    Posted 2 years ago #

    hi, thanks for the nice plugin. I have a suggestion to improve the code a bit. right now it produces lots of php errors when WP_DEBUG is set to true when creating a new widget. not a big deal but for those that have it turned on while doing development, the plugin is unusable.

    in function form() instead of using $instance["title"] a better approach would be something like this:

    $title = isset( $instance["title"] ) ? $instance["title"] : '';

    using isset() or ! empty() stops the debug errors for unset array elements.
    bonus: you can even set defaults if you wanted to.


  2. maxoud
    Posted 2 years ago #

    It's a bad practice to produce the code generatinge too many Notices as there is a probability to never recognize an important one.

    One more point is that this plugin has been written when WP_DEBUG == false so it's impossible to entrust it and for that reason should be avoided.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Category Posts Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.