WordPress.org

Ready to get started?Download WordPress

Forums

Category Posts Widget
code improvement suggestion (2 posts)

  1. Dwenaus
    Member
    Posted 1 year 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.

    http://wordpress.org/extend/plugins/category-posts/

  2. maxoud
    Member
    Posted 1 year 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

About this Topic

Tags

No tags yet.